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

Unified Diff: base/process/process_metrics.h

Issue 888193002: ProcessMetrics::GetCPUUsage() is Slow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/process/process_metrics_linux.cc » ('j') | base/process/process_metrics_linux.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_metrics.h
diff --git a/base/process/process_metrics.h b/base/process/process_metrics.h
index 5916b94148cb2e6e9a6782096bcca49fd7b8f41a..6bd6aad5da75a4468486964d5787389c8939f16b 100644
--- a/base/process/process_metrics.h
+++ b/base/process/process_metrics.h
@@ -247,6 +247,14 @@ BASE_EXPORT void SetFdLimit(unsigned int max_descriptors);
// Exposed for testing.
BASE_EXPORT int ParseProcStatCPU(const std::string& input);
+// Extract the sum of the CPU-related ticks from the given |input| which
+// contains the stats found in /proc/<pid>/stat. Returns -1 on error.
+//
+// Use this version instead of the above for faster results.
+//
+// Exposed for testing.
+BASE_EXPORT int GetCpuFromProcStats(const std::string& input);
danakj 2015/02/03 18:51:09 why are you adding a new method with the same retu
afakhry 2015/02/03 20:23:54 I wanted to keep the old one for reference, but yo
+
// Get the number of threads of |process| as available in /proc/<pid>/stat.
// This should be used with care as no synchronization with running threads is
// done. This is mostly useful to guarantee being single-threaded.
« no previous file with comments | « no previous file | base/process/process_metrics_linux.cc » ('j') | base/process/process_metrics_linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698