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

Unified Diff: tools/telemetry/telemetry/core/browser.py

Issue 23717016: Add cpu_stats for the browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/platform/linux_platform_backend.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/browser.py
diff --git a/tools/telemetry/telemetry/core/browser.py b/tools/telemetry/telemetry/core/browser.py
index a2a9fd5c274f08f21ca1f3772b780fc60f702eb0..7eda3c5a454d4f87e907b015c449378be91556fb 100644
--- a/tools/telemetry/telemetry/core/browser.py
+++ b/tools/telemetry/telemetry/core/browser.py
@@ -168,6 +168,35 @@ class Browser(object):
return result
@property
+ def cpu_stats(self):
+ """Returns a dict of cpu statistics for the system.
+ { 'Browser': {
+ 'CpuProcessTime': S,
+ 'TotalTime': T
+ },
+ 'Gpu': {
+ 'CpuProcessTime': S,
+ 'TotalTime': T
+ },
+ 'Renderer': {
+ 'CpuProcessTime': S,
+ 'TotalTime': T
+ }
+ }
+ Any of the above keys may be missing on a per-platform basis.
+ """
+ result = self._GetStatsCommon(self._platform_backend.GetCpuStats)
+ del result['ProcessCount']
+
+ # We want a single time value, not the sum for all processes.
+ for process_type in result:
+ # Skip any process_types that are empty
+ if not len(result[process_type]):
+ continue
+ result[process_type].update(self._platform_backend.GetCpuTimestamp())
+ return result
+
+ @property
def io_stats(self):
"""Returns a dict of IO statistics for the browser:
{ 'Browser': {
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/platform/linux_platform_backend.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698