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

Unified Diff: tools/telemetry/telemetry/core/platform/power_monitor/sysfs_power_monitor.py

Issue 679813002: [telemetry] Drop data for sysfs power monitor if distribution changes but total does not. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment. Created 6 years, 1 month 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/power_monitor/sysfs_power_monitor_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/power_monitor/sysfs_power_monitor.py
diff --git a/tools/telemetry/telemetry/core/platform/power_monitor/sysfs_power_monitor.py b/tools/telemetry/telemetry/core/platform/power_monitor/sysfs_power_monitor.py
index 5c708802a844aedac11e725c1be362e8ef7ce8cd..57eb6982d4ebafc339a00be05bdedbf208c9e1f5 100644
--- a/tools/telemetry/telemetry/core/platform/power_monitor/sysfs_power_monitor.py
+++ b/tools/telemetry/telemetry/core/platform/power_monitor/sysfs_power_monitor.py
@@ -170,6 +170,11 @@ class SysfsPowerMonitor(power_monitor.PowerMonitor):
for state in initial[cpu]:
current_cpu[state] = final[cpu][state] - initial[cpu][state]
total += current_cpu[state]
+ if total == 0:
+ # Somehow it's possible for initial and final to have the same sum,
+ # but a different distribution, making total == 0. crbug.com/426430
+ cpu_stats[cpu] = collections.defaultdict(int)
+ continue
for state in current_cpu:
current_cpu[state] /= (float(total) / 100.0)
# Calculate the average c-state residency across all CPUs.
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/platform/power_monitor/sysfs_power_monitor_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698