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 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // 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. |
66 // 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 |
67 // simply |pid|, and the next two values are strings. | 67 // simply |pid|, and the next two values are strings. |
68 int64_t GetProcStatsFieldAsInt64(const std::vector<std::string>& proc_stats, | 68 int64_t GetProcStatsFieldAsInt64(const std::vector<std::string>& proc_stats, |
69 ProcStatsFields field_num); | 69 ProcStatsFields field_num); |
70 | 70 |
71 // Same as GetProcStatsFieldAsInt64(), but for size_t values. | 71 // Same as GetProcStatsFieldAsInt64(), but for size_t values. |
72 size_t GetProcStatsFieldAsSizeT(const std::vector<std::string>& proc_stats, | 72 size_t GetProcStatsFieldAsSizeT(const std::vector<std::string>& proc_stats, |
73 ProcStatsFields field_num); | 73 ProcStatsFields field_num); |
74 | 74 |
75 // Convenience wrapper around GetProcStatsFieldAsInt64(), ParseProcStats() and | 75 // Convenience wrappers around GetProcStatsFieldAsInt64(), ParseProcStats() and |
76 // ReadProcStats(). See GetProcStatsFieldAsInt64() for details. | 76 // ReadProcStats(). See GetProcStatsFieldAsInt64() for details. |
| 77 int64_t ReadStatsFilendGetFieldAsInt64(const FilePath& stat_file, |
| 78 ProcStatsFields field_num); |
77 int64_t ReadProcStatsAndGetFieldAsInt64(pid_t pid, ProcStatsFields field_num); | 79 int64_t ReadProcStatsAndGetFieldAsInt64(pid_t pid, ProcStatsFields field_num); |
| 80 int64_t ReadProcSelfStatsAndGetFieldAsInt64(ProcStatsFields field_num); |
78 | 81 |
79 // Same as ReadProcStatsAndGetFieldAsInt64() but for size_t values. | 82 // Same as ReadProcStatsAndGetFieldAsInt64() but for size_t values. |
80 size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid, | 83 size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid, |
81 ProcStatsFields field_num); | 84 ProcStatsFields field_num); |
82 | 85 |
83 // Returns the time that the OS started. Clock ticks are relative to this. | 86 // Returns the time that the OS started. Clock ticks are relative to this. |
84 Time GetBootTime(); | 87 Time GetBootTime(); |
85 | 88 |
86 // Returns the amount of time spent in user space since boot across all CPUs. | 89 // Returns the amount of time spent in user space since boot across all CPUs. |
87 TimeDelta GetUserCpuTimeSinceBoot(); | 90 TimeDelta GetUserCpuTimeSinceBoot(); |
88 | 91 |
89 // Converts Linux clock ticks to a wall time delta. | 92 // Converts Linux clock ticks to a wall time delta. |
90 TimeDelta ClockTicksToTimeDelta(int clock_ticks); | 93 TimeDelta ClockTicksToTimeDelta(int clock_ticks); |
91 | 94 |
92 } // namespace internal | 95 } // namespace internal |
93 } // namespace base | 96 } // namespace base |
94 | 97 |
95 #endif // BASE_PROCESS_INTERNAL_LINUX_H_ | 98 #endif // BASE_PROCESS_INTERNAL_LINUX_H_ |
OLD | NEW |