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

Unified Diff: tools/telemetry/telemetry/core/platform/linux_platform_backend.py

Issue 23717016: Add cpu_stats for the browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Using /proc to get current CPU counters Created 7 years, 3 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
Index: tools/telemetry/telemetry/core/platform/linux_platform_backend.py
diff --git a/tools/telemetry/telemetry/core/platform/linux_platform_backend.py b/tools/telemetry/telemetry/core/platform/linux_platform_backend.py
index 42d6e947a84ecaa6944a35572381e9caeef88979..1f35558a107d744f9b9a7c03df2b466fb9475c56 100644
--- a/tools/telemetry/telemetry/core/platform/linux_platform_backend.py
+++ b/tools/telemetry/telemetry/core/platform/linux_platform_backend.py
@@ -29,6 +29,11 @@ class LinuxPlatformBackend(posix_platform_backend.PosixPlatformBackend):
meminfo_contents = self._GetFileContents('/proc/meminfo')
return proc_util.GetSystemCommitCharge(meminfo_contents)
+ def GetCpuStats(self, pid=None):
+ uptime = self._GetFileContents('/proc/uptime').split()
+ stats = self._GetFileContents('/proc/%s/stat' % pid).split()
+ return proc_util.GetCpuStats(uptime, stats)
+
def GetMemoryStats(self, pid):
status = self._GetFileContents('/proc/%s/status' % pid)
stats = self._GetFileContents('/proc/%s/stat' % pid).split()

Powered by Google App Engine
This is Rietveld 408576698