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

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

Issue 147593004: [Telemetry] Allow --report-root-metrics to work on unsupported hardware. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 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 | tools/telemetry/telemetry/core/platform/mac_platform_backend_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/platform/mac_platform_backend.py
diff --git a/tools/telemetry/telemetry/core/platform/mac_platform_backend.py b/tools/telemetry/telemetry/core/platform/mac_platform_backend.py
index 5f27c35c911e696a00326225c2cfa9b8df9d916b..95dbe1bd1bc747578e0385357f410cad42c2a0eb 100644
--- a/tools/telemetry/telemetry/core/platform/mac_platform_backend.py
+++ b/tools/telemetry/telemetry/core/platform/mac_platform_backend.py
@@ -201,7 +201,10 @@ class MacPlatformBackend(posix_platform_backend.PosixPlatformBackend):
# Duration of this sample.
sample_duration_ms = int(plist['elapsed_ns']) / 10**6
+ if 'processor' not in plist:
+ continue
processor = plist['processor']
+
energy_consumption_mw = int(processor.get('package_watts', 0)) * 10**3
total_energy_consumption_mwh += (energy_consumption_mw *
@@ -212,8 +215,9 @@ class MacPlatformBackend(posix_platform_backend.PosixPlatformBackend):
# -------- Collect and Process Data -------------
out_dict = {}
# Raw power usage samples.
- out_dict['power_samples_mw'] = power_samples
- out_dict['energy_consumption_mwh'] = total_energy_consumption_mwh
+ if power_samples:
+ out_dict['power_samples_mw'] = power_samples
+ out_dict['energy_consumption_mwh'] = total_energy_consumption_mwh
return out_dict
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/platform/mac_platform_backend_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698