OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file contains internal routines that are called by other files in | 5 // This file contains internal routines that are called by other files in |
6 // base/process/. | 6 // base/process/. |
7 | 7 |
8 #ifndef BASE_PROCESS_LINUX_INTERNAL_H_ | 8 #ifndef BASE_PROCESS_LINUX_INTERNAL_H_ |
9 #define BASE_PROCESS_LINUX_INTERNAL_H_ | 9 #define BASE_PROCESS_LINUX_INTERNAL_H_ |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 VM_STIME = 14, // Time scheduled in kernel mode in clock ticks. | 56 VM_STIME = 14, // Time scheduled in kernel mode in clock ticks. |
57 VM_NUMTHREADS = 19, // Number of threads. | 57 VM_NUMTHREADS = 19, // Number of threads. |
58 VM_STARTTIME = 21, // The time the process started in clock ticks. | 58 VM_STARTTIME = 21, // The time the process started in clock ticks. |
59 VM_VSIZE = 22, // Virtual memory size in bytes. | 59 VM_VSIZE = 22, // Virtual memory size in bytes. |
60 VM_RSS = 23, // Resident Set Size in pages. | 60 VM_RSS = 23, // Resident Set Size in pages. |
61 }; | 61 }; |
62 | 62 |
63 // Reads the |field_num|th field from |proc_stats|. Returns 0 on failure. | 63 // Reads the |field_num|th field from |proc_stats|. Returns 0 on failure. |
64 // This version does not handle the first 3 values, since the first value is | 64 // This version does not handle the first 3 values, since the first value is |
65 // simply |pid|, and the next two values are strings. | 65 // simply |pid|, and the next two values are strings. |
66 int GetProcStatsFieldAsInt(const std::vector<std::string>& proc_stats, | 66 int64 GetProcStatsFieldAsInt64(const std::vector<std::string>& proc_stats, |
67 ProcStatsFields field_num); | 67 ProcStatsFields field_num); |
68 | 68 |
69 // Same as GetProcStatsFieldAsInt(), but for size_t values. | 69 // Same as GetProcStatsFieldAsInt64(), but for size_t values. |
70 size_t GetProcStatsFieldAsSizeT(const std::vector<std::string>& proc_stats, | 70 size_t GetProcStatsFieldAsSizeT(const std::vector<std::string>& proc_stats, |
71 ProcStatsFields field_num); | 71 ProcStatsFields field_num); |
72 | 72 |
73 // Convenience wrapper around GetProcStatsFieldAsInt(), ParseProcStats() and | 73 // Convenience wrapper around GetProcStatsFieldAsInt64(), ParseProcStats() and |
74 // ReadProcStats(). See GetProcStatsFieldAsInt() for details. | 74 // ReadProcStats(). See GetProcStatsFieldAsInt64() for details. |
75 int ReadProcStatsAndGetFieldAsInt(pid_t pid, | 75 int64 ReadProcStatsAndGetFieldAsInt64(pid_t pid, ProcStatsFields field_num); |
76 ProcStatsFields field_num); | |
77 | 76 |
78 // Same as ReadProcStatsAndGetFieldAsInt() but for size_t values. | 77 // Same as ReadProcStatsAndGetFieldAsInt64() but for size_t values. |
79 size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid, | 78 size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid, |
80 ProcStatsFields field_num); | 79 ProcStatsFields field_num); |
81 | 80 |
82 // Returns the time that the OS started. Clock ticks are relative to this. | 81 // Returns the time that the OS started. Clock ticks are relative to this. |
83 Time GetBootTime(); | 82 Time GetBootTime(); |
84 | 83 |
85 // Converts Linux clock ticks to a wall time delta. | 84 // Converts Linux clock ticks to a wall time delta. |
86 TimeDelta ClockTicksToTimeDelta(int clock_ticks); | 85 TimeDelta ClockTicksToTimeDelta(int clock_ticks); |
87 | 86 |
88 } // namespace internal | 87 } // namespace internal |
89 } // namespace base | 88 } // namespace base |
90 | 89 |
91 #endif // BASE_PROCESS_LINUX_INTERNAL_H_ | 90 #endif // BASE_PROCESS_LINUX_INTERNAL_H_ |
OLD | NEW |