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

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

Issue 577893003: Telemetry: Implement MSR power monitoring on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, use rdmsr binary to read the MSRs Created 6 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/power_monitor/msr_power_monitor.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/platform/linux_platform_backend.py
diff --git a/tools/telemetry/telemetry/core/platform/linux_platform_backend.py b/tools/telemetry/telemetry/core/platform/linux_platform_backend.py
index c46c5717164aab34e0d32c71513e71ccd414662d..9e6cb55c75771cad435fcb9fdcf071ef1bb59b52 100644
--- a/tools/telemetry/telemetry/core/platform/linux_platform_backend.py
+++ b/tools/telemetry/telemetry/core/platform/linux_platform_backend.py
@@ -11,6 +11,7 @@ from telemetry import decorators
from telemetry.core.platform import linux_based_platform_backend
from telemetry.core.platform import platform_backend
from telemetry.core.platform import posix_platform_backend
+from telemetry.core.platform.power_monitor import msr_power_monitor
from telemetry.util import cloud_storage
from telemetry.util import support_binaries
@@ -24,6 +25,9 @@ _POSSIBLE_PERFHOST_APPLICATIONS = [
class LinuxPlatformBackend(
posix_platform_backend.PosixPlatformBackend,
linux_based_platform_backend.LinuxBasedPlatformBackend):
+ def __init__(self):
+ super(LinuxPlatformBackend, self).__init__()
+ self._power_monitor = msr_power_monitor.MsrPowerMonitor(self)
def StartRawDisplayFrameRateMeasurement(self):
raise NotImplementedError()
@@ -87,6 +91,31 @@ class LinuxPlatformBackend(
raise NotImplementedError(
'Please teach Telemetry how to install ' + application)
+ def CanMonitorPower(self):
+ return self._power_monitor.CanMonitorPower()
+
+ def CanMeasurePerApplicationPower(self):
+ return self._power_monitor.CanMeasurePerApplicationPower()
+
+ def StartMonitoringPower(self, browser):
+ self._power_monitor.StartMonitoringPower(browser)
+
+ def StopMonitoringPower(self):
+ return self._power_monitor.StopMonitoringPower()
+
+ def ReadMsr(self, msr_number):
+ cmd = ['/usr/sbin/rdmsr', '-d', str(msr_number)]
+ (out, err) = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).communicate()
+ if err:
+ raise OSError(err)
+ try:
+ result = int(out)
+ except ValueError:
+ raise OSError('Cannot interpret rdmsr output: %s' % out)
+ return result
+
def _IsIpfwKernelModuleInstalled(self):
return 'ipfw_mod' in subprocess.Popen(
['lsmod'], stdout=subprocess.PIPE).communicate()[0]
« no previous file with comments | « no previous file | tools/telemetry/telemetry/core/platform/power_monitor/msr_power_monitor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698