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

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

Issue 635313002: [Telemetry] Fix C-State stat reading for Note 3 and S5. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: More descriptive test name Created 6 years, 2 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 | « 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 a01862433c29125b6ffe6b7ecf9a31697e36f245..1a57f5b65af440f5350e1329f7daee74cb906609 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
@@ -5,6 +5,7 @@
import unittest
from telemetry.core.platform.power_monitor import sysfs_power_monitor
+from telemetry.core.platform import android_platform_backend
class SysfsPowerMonitorMonitorTest(unittest.TestCase):
@@ -193,3 +194,34 @@ class SysfsPowerMonitorMonitorTest(unittest.TestCase):
for freq in results[cpu]:
self.assertAlmostEqual(results[cpu][freq],
self.expected_freq_percents[cpu][freq])
+
+ def testGetCpuStateForAndroidDevices(self):
+ class PlatformStub(object):
+ def __init__(self, run_command_return_value):
+ self._run_command_return_value = run_command_return_value
+ def RunCommand(self, _cmd):
+ return self._run_command_return_value
+
+ cpu_state_from_samsung_note3 = (
+ "C0\n\nC1\n\nC2\n\nC3\n\n"
+ "53658520886\n1809072\n7073\n1722554\n"
+ "1\n35\n300\n500\n"
+ "1412949256\n")
+ expected_cstate_dict = {
+ 'C0': 1412895593940415,
+ 'C1': 1809072,
+ 'C2': 7073,
+ 'C3': 1722554,
+ 'WFI': 53658520886
+ }
+ cpus = ["cpu%d" % cpu for cpu in range(2)]
+ expected_result = dict(zip(cpus, [expected_cstate_dict]*len(cpus)))
+
+ sysfsmon = sysfs_power_monitor.SysfsPowerMonitor(
+ PlatformStub(cpu_state_from_samsung_note3))
+ # pylint: disable=W0212
+ sysfsmon._cpus = cpus
+ cstate = sysfsmon.GetCpuState()
+ result = android_platform_backend.AndroidPlatformBackend.ParseCStateSample(
+ cstate)
+ self.assertDictEqual(expected_result, result)
« 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