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_INTERNAL_LINUX_H_ | 8 #ifndef BASE_PROCESS_INTERNAL_LINUX_H_ |
9 #define BASE_PROCESS_INTERNAL_LINUX_H_ | 9 #define BASE_PROCESS_INTERNAL_LINUX_H_ |
10 | 10 |
| 11 #include <stddef.h> |
| 12 #include <stdint.h> |
11 #include <unistd.h> | 13 #include <unistd.h> |
12 | 14 |
13 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
14 | 16 |
15 namespace base { | 17 namespace base { |
16 | 18 |
17 class Time; | 19 class Time; |
18 class TimeDelta; | 20 class TimeDelta; |
19 | 21 |
20 namespace internal { | 22 namespace internal { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 VM_STIME = 14, // Time scheduled in kernel mode in clock ticks. | 58 VM_STIME = 14, // Time scheduled in kernel mode in clock ticks. |
57 VM_NUMTHREADS = 19, // Number of threads. | 59 VM_NUMTHREADS = 19, // Number of threads. |
58 VM_STARTTIME = 21, // The time the process started in clock ticks. | 60 VM_STARTTIME = 21, // The time the process started in clock ticks. |
59 VM_VSIZE = 22, // Virtual memory size in bytes. | 61 VM_VSIZE = 22, // Virtual memory size in bytes. |
60 VM_RSS = 23, // Resident Set Size in pages. | 62 VM_RSS = 23, // Resident Set Size in pages. |
61 }; | 63 }; |
62 | 64 |
63 // Reads the |field_num|th field from |proc_stats|. Returns 0 on failure. | 65 // 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 | 66 // This version does not handle the first 3 values, since the first value is |
65 // simply |pid|, and the next two values are strings. | 67 // simply |pid|, and the next two values are strings. |
66 int64 GetProcStatsFieldAsInt64(const std::vector<std::string>& proc_stats, | 68 int64_t GetProcStatsFieldAsInt64(const std::vector<std::string>& proc_stats, |
67 ProcStatsFields field_num); | 69 ProcStatsFields field_num); |
68 | 70 |
69 // Same as GetProcStatsFieldAsInt64(), but for size_t values. | 71 // Same as GetProcStatsFieldAsInt64(), but for size_t values. |
70 size_t GetProcStatsFieldAsSizeT(const std::vector<std::string>& proc_stats, | 72 size_t GetProcStatsFieldAsSizeT(const std::vector<std::string>& proc_stats, |
71 ProcStatsFields field_num); | 73 ProcStatsFields field_num); |
72 | 74 |
73 // Convenience wrapper around GetProcStatsFieldAsInt64(), ParseProcStats() and | 75 // Convenience wrapper around GetProcStatsFieldAsInt64(), ParseProcStats() and |
74 // ReadProcStats(). See GetProcStatsFieldAsInt64() for details. | 76 // ReadProcStats(). See GetProcStatsFieldAsInt64() for details. |
75 int64 ReadProcStatsAndGetFieldAsInt64(pid_t pid, ProcStatsFields field_num); | 77 int64_t ReadProcStatsAndGetFieldAsInt64(pid_t pid, ProcStatsFields field_num); |
76 | 78 |
77 // Same as ReadProcStatsAndGetFieldAsInt64() but for size_t values. | 79 // Same as ReadProcStatsAndGetFieldAsInt64() but for size_t values. |
78 size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid, | 80 size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid, |
79 ProcStatsFields field_num); | 81 ProcStatsFields field_num); |
80 | 82 |
81 // Returns the time that the OS started. Clock ticks are relative to this. | 83 // Returns the time that the OS started. Clock ticks are relative to this. |
82 Time GetBootTime(); | 84 Time GetBootTime(); |
83 | 85 |
84 // Converts Linux clock ticks to a wall time delta. | 86 // Converts Linux clock ticks to a wall time delta. |
85 TimeDelta ClockTicksToTimeDelta(int clock_ticks); | 87 TimeDelta ClockTicksToTimeDelta(int clock_ticks); |
86 | 88 |
87 } // namespace internal | 89 } // namespace internal |
88 } // namespace base | 90 } // namespace base |
89 | 91 |
90 #endif // BASE_PROCESS_INTERNAL_LINUX_H_ | 92 #endif // BASE_PROCESS_INTERNAL_LINUX_H_ |
OLD | NEW |