Index: tools/telemetry/telemetry/core/platform/profiler/perf_profiler.py |
diff --git a/tools/telemetry/telemetry/core/platform/profiler/perf_profiler.py b/tools/telemetry/telemetry/core/platform/profiler/perf_profiler.py |
index 9f0c473b619e057439ef23e5f8d899cd5bdf470a..3a0652b54a2aca8f2cb6bf5cfcd50c15d9df2f98 100644 |
--- a/tools/telemetry/telemetry/core/platform/profiler/perf_profiler.py |
+++ b/tools/telemetry/telemetry/core/platform/profiler/perf_profiler.py |
@@ -10,6 +10,8 @@ import subprocess |
import sys |
import tempfile |
+from pylib.device import device_errors # pylint: disable=F0401 |
+ |
from telemetry.core import platform |
from telemetry.core import util |
from telemetry.core.platform import profiler |
@@ -52,10 +54,11 @@ def _PrepareHostForPerf(): |
def _InstallPerfHost(): |
+ perfhost_name = android_profiling_helper.GetPerfhostName() |
host = platform.GetHostPlatform() |
- if not host.CanLaunchApplication('perfhost'): |
- host.InstallApplication('perfhost') |
- return support_binaries.FindPath('perfhost', host.GetOSName()) |
+ if not host.CanLaunchApplication(perfhost_name): |
+ host.InstallApplication(perfhost_name) |
+ return support_binaries.FindPath(perfhost_name, 'linux') |
class _SingleProcessPerfProfiler(object): |
@@ -100,7 +103,10 @@ class _SingleProcessPerfProfiler(object): |
'"--extra-browser-args=--single-process"') |
if self._is_android: |
device = self._browser_backend.adb.device() |
- device.KillAll('perf', signum=signal.SIGINT, blocking=True) |
+ try: |
+ device.KillAll('perf', signum=signal.SIGINT, blocking=True) |
+ except device_errors.CommandFailedError: |
+ logging.warning('The perf process could not be killed on the device.') |
self._proc.send_signal(signal.SIGINT) |
exit_code = self._proc.wait() |
try: |
@@ -221,8 +227,8 @@ class PerfProfiler(profiler.Profiler): |
with open(os.devnull, 'w') as devnull: |
_InstallPerfHost() |
report = subprocess.Popen( |
- ['perfhost', 'report', '--show-total-period', '-U', '-t', '^', '-i', |
- file_name], |
+ [android_profiling_helper.GetPerfhostName(), |
+ 'report', '--show-total-period', '-U', '-t', '^', '-i', file_name], |
stdout=subprocess.PIPE, stderr=devnull).communicate()[0] |
period_by_function = {} |
for line in report.split('\n'): |