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

Unified Diff: base/process/process_metrics.h

Issue 1384363002: [NOT TO COMMIT YET] Using proc/pid/status file contents to get process metrics in linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@smaps_fscan
Patch Set: Remove the trace_event changes. Created 5 years, 2 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 54b10aaacfa2f5cfb0ab3ffc702fbc226435c325..fdf2389ce6efb1a1e044763a2484eb53e015b38f 100644
--- a/base/process/process_metrics.h
+++ b/base/process/process_metrics.h
@@ -307,6 +307,14 @@ BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo);
// Exposed for testing.
BASE_EXPORT int ParseProcStatCPU(const std::string& input);
+// Parses the /proc/<pid>/status file contents passed and sets |value| to the
+// size in bytes corresponding to the |field|. Only works for fields in the form
+// of "Field: value kB". Returns true on success.
+BASE_EXPORT bool ParseProcStatusAndGetField(
Lei Zhang 2015/10/07 16:10:54 Why not #if defined(OS_LINUX) // and possible defi
ssid 2015/10/07 17:11:34 It is expected that it will be needed in future si
Lei Zhang 2015/10/08 06:31:30 It turned out I didn't sleep enough last night and
+ const std::string& proc_status_contents,
Lei Zhang 2015/10/07 16:10:54 Why not StringPiece?
ssid 2015/10/07 17:11:34 Hm yes, changed.
+ const std::string& field,
+ size_t* value);
+
// 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