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

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

Issue 144543007: [Telemetry] Add power usage metric (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Whitespace fix 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 | « tools/perf/unit-info.json ('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/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 fbf519c0990d9effecf5d479104138b35a74a18e..5f27c35c911e696a00326225c2cfa9b8df9d916b 100644
--- a/tools/telemetry/telemetry/core/platform/mac_platform_backend.py
+++ b/tools/telemetry/telemetry/core/platform/mac_platform_backend.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import ctypes
+import logging
import os
import plistlib
import signal
@@ -35,9 +36,15 @@ class MacPlatformBackend(posix_platform_backend.PosixPlatformBackend):
self._powermetrics_output_file = tempfile.NamedTemporaryFile().name
args = [self.binary_path, '-f', 'plist', '-i',
'%d' % SAMPLE_INTERVAL_MS, '-u', self._powermetrics_output_file]
- # TODO(jeremy): Need to ensure command is run as root user.
+
+ # powermetrics writes lots of output to stderr, don't echo unless verbose
+ # logging enabled.
+ stderror_destination = subprocess.PIPE
+ if logging.getLogger().isEnabledFor(logging.DEBUG):
+ stderror_destination = None
+
self._powermetrics_process = subprocess.Popen(args,
- stdout=subprocess.PIPE)
+ stdout=subprocess.PIPE, stderr=stderror_destination)
def StopMonitoringPowerAsync(self):
assert self._powermetrics_process, (
« no previous file with comments | « tools/perf/unit-info.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698