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

Unified Diff: tools/telemetry/telemetry/core/platform/power_monitor/sysfs_power_monitor_unittest.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 | « tools/telemetry/telemetry/core/platform/power_monitor/sysfs_power_monitor.py ('k') | no next file » | 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_unittest.py
diff --git a/tools/telemetry/telemetry/core/platform/power_monitor/sysfs_power_monitor_unittest.py b/tools/telemetry/telemetry/core/platform/power_monitor/sysfs_power_monitor_unittest.py
index 1a57f5b65af440f5350e1329f7daee74cb906609..6ba2cc892c1b3ea6ce89574e49d9a2882c68767d 100644
--- a/tools/telemetry/telemetry/core/platform/power_monitor/sysfs_power_monitor_unittest.py
+++ b/tools/telemetry/telemetry/core/platform/power_monitor/sysfs_power_monitor_unittest.py
@@ -195,6 +195,26 @@ class SysfsPowerMonitorMonitorTest(unittest.TestCase):
self.assertAlmostEqual(results[cpu][freq],
self.expected_freq_percents[cpu][freq])
+ def testComputeCpuStatsWithMissingData(self):
+ results = sysfs_power_monitor.SysfsPowerMonitor.ComputeCpuStats(
+ {'cpu1': {}}, {'cpu1': {}})
+ self.assertEqual(results['cpu1'][12345], 0)
+
+ results = sysfs_power_monitor.SysfsPowerMonitor.ComputeCpuStats(
+ {'cpu1': {123: 0}}, {'cpu1': {123: 0}})
+ self.assertEqual(results['cpu1'][123], 0)
+
+ results = sysfs_power_monitor.SysfsPowerMonitor.ComputeCpuStats(
+ {'cpu1': {123: 456}}, {'cpu1': {123: 456}})
+ self.assertEqual(results['cpu1'][123], 0)
+
+ def testComputeCpuStatsWithNumberChange(self):
+ results = sysfs_power_monitor.SysfsPowerMonitor.ComputeCpuStats(
+ {'cpu1': {'C0': 10, 'WFI': 20}},
+ {'cpu1': {'C0': 20, 'WFI': 10}})
+ self.assertEqual(results['cpu1']['C0'], 0)
+ self.assertEqual(results['cpu1']['WFI'], 0)
+
def testGetCpuStateForAndroidDevices(self):
class PlatformStub(object):
def __init__(self, run_command_return_value):
« no previous file with comments | « tools/telemetry/telemetry/core/platform/power_monitor/sysfs_power_monitor.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698