summaryrefslogtreecommitdiff
path: root/systrace/catapult/telemetry/telemetry/internal/platform/profiler/java_heap_profiler.py
diff options
context:
space:
mode:
Diffstat (limited to 'systrace/catapult/telemetry/telemetry/internal/platform/profiler/java_heap_profiler.py')
-rw-r--r--systrace/catapult/telemetry/telemetry/internal/platform/profiler/java_heap_profiler.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/systrace/catapult/telemetry/telemetry/internal/platform/profiler/java_heap_profiler.py b/systrace/catapult/telemetry/telemetry/internal/platform/profiler/java_heap_profiler.py
index d815693..c127a19 100644
--- a/systrace/catapult/telemetry/telemetry/internal/platform/profiler/java_heap_profiler.py
+++ b/systrace/catapult/telemetry/telemetry/internal/platform/profiler/java_heap_profiler.py
@@ -2,7 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import logging
import os
import subprocess
import threading
@@ -49,14 +48,12 @@ class JavaHeapProfiler(profiler.Profiler):
def CollectProfile(self):
self._timer.cancel()
self._DumpJavaHeap(True)
- try:
- self._browser_backend.device.PullFile(
- self._DEFAULT_DEVICE_DIR, self._output_path)
- except:
- logging.exception('New exception caused by DeviceUtils conversion')
- raise
+ self._browser_backend.device.PullFile(
+ self._DEFAULT_DEVICE_DIR, self._output_path)
+ # Note: command must be passed as a string to expand wildcards.
self._browser_backend.device.RunShellCommand(
- 'rm ' + os.path.join(self._DEFAULT_DEVICE_DIR, '*'))
+ 'rm -f ' + os.path.join(self._DEFAULT_DEVICE_DIR, '*'),
+ check_return=True, shell=True)
output_files = []
for f in os.listdir(self._output_path):
if os.path.splitext(f)[1] == '.aprof':
@@ -77,16 +74,16 @@ class JavaHeapProfiler(profiler.Profiler):
if not self._browser_backend.device.FileExists(
self._DEFAULT_DEVICE_DIR):
self._browser_backend.device.RunShellCommand(
- 'mkdir -p ' + self._DEFAULT_DEVICE_DIR)
+ ['mkdir', '-p', self._DEFAULT_DEVICE_DIR], check_return=True)
self._browser_backend.device.RunShellCommand(
- 'chmod 777 ' + self._DEFAULT_DEVICE_DIR)
+ ['chmod', '777', self._DEFAULT_DEVICE_DIR], check_return=True)
device_dump_file = None
for pid in self._GetProcessOutputFileMap().iterkeys():
device_dump_file = '%s/%s.%s.aprof' % (self._DEFAULT_DEVICE_DIR, pid,
self._run_count)
- self._browser_backend.device.RunShellCommand('am dumpheap %s %s' %
- (pid, device_dump_file))
+ self._browser_backend.device.RunShellCommand(
+ ['am', 'dumpheap', str(pid), device_dump_file], check_return=True)
if device_dump_file and wait_for_completion:
py_utils.WaitFor(lambda: self._FileSize(device_dump_file) > 0, timeout=2)
self._run_count += 1