Chromium Code Reviews| 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] |