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

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: 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
« tools/perf/metrics/power.py ('K') | « tools/perf/metrics/power.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/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 a427a7e692b968b7f3de48be18aa46c452bb6a94..970d72d8a306db0e4eafb91970e1ae030177eb99 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 = ['sudo', 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 = None
+ if logging.getLogger().getEffectiveLevel() > logging.INFO:
tonyg 2014/01/23 18:23:40 Nice! Thanks for adding this. In other places, we'
jeremy 2014/01/23 18:58:41 Done.
+ stderror_destination = subprocess.PIPE
+
self._powermetrics_process = subprocess.Popen(args,
- stdout=subprocess.PIPE)
+ stdout=subprocess.PIPE, stderr=stderror_destination)
def _SendPrivilegedSignal(self, pid, signal_num):
args = ['sudo', 'kill', '-%d' % signal_num, '%d' % pid]
« tools/perf/metrics/power.py ('K') | « tools/perf/metrics/power.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698