Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Side by Side Diff: base/process/internal_linux.h

Issue 2715583002: base/process: Use /proc/self/stat to read startup time. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/process/internal_linux.cc » ('j') | base/process/internal_linux.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 ReadProcStatsAndGetFieldAsInt64(const std::string& pid,
jln (very slow on Chromium) 2017/02/22 22:37:15 Nit: I think we still don't allow overloading like
Daniele Castagna 2017/02/23 18:04:10 Overloading should be fine as long as it's not con
78 ProcStatsFields field_num);
77 int64_t ReadProcStatsAndGetFieldAsInt64(pid_t pid, ProcStatsFields field_num); 79 int64_t ReadProcStatsAndGetFieldAsInt64(pid_t pid, ProcStatsFields field_num);
78 80
79 // Same as ReadProcStatsAndGetFieldAsInt64() but for size_t values. 81 // Same as ReadProcStatsAndGetFieldAsInt64() but for size_t values.
80 size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid, 82 size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid,
81 ProcStatsFields field_num); 83 ProcStatsFields field_num);
82 84
83 // Returns the time that the OS started. Clock ticks are relative to this. 85 // Returns the time that the OS started. Clock ticks are relative to this.
84 Time GetBootTime(); 86 Time GetBootTime();
85 87
86 // Returns the amount of time spent in user space since boot across all CPUs. 88 // Returns the amount of time spent in user space since boot across all CPUs.
87 TimeDelta GetUserCpuTimeSinceBoot(); 89 TimeDelta GetUserCpuTimeSinceBoot();
88 90
89 // Converts Linux clock ticks to a wall time delta. 91 // Converts Linux clock ticks to a wall time delta.
90 TimeDelta ClockTicksToTimeDelta(int clock_ticks); 92 TimeDelta ClockTicksToTimeDelta(int clock_ticks);
91 93
92 } // namespace internal 94 } // namespace internal
93 } // namespace base 95 } // namespace base
94 96
95 #endif // BASE_PROCESS_INTERNAL_LINUX_H_ 97 #endif // BASE_PROCESS_INTERNAL_LINUX_H_
OLDNEW
« no previous file with comments | « no previous file | base/process/internal_linux.cc » ('j') | base/process/internal_linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698