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: build/android/pylib/local/device/local_device_perf_test_run.py

Issue 2583613002: [Android] Add ability to generate test trace json for perf tests runs. (Closed)
Patch Set: [Android] Add ability to generate test trace json for perf tests runs. Created 4 years 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
Index: build/android/pylib/local/device/local_device_perf_test_run.py
diff --git a/build/android/pylib/local/device/local_device_perf_test_run.py b/build/android/pylib/local/device/local_device_perf_test_run.py
index efb00017c2eb61e1619a062266cf28d2ecf9e573..74ed5d595a444e623179cc29d29f649580313011 100644
--- a/build/android/pylib/local/device/local_device_perf_test_run.py
+++ b/build/android/pylib/local/device/local_device_perf_test_run.py
@@ -29,6 +29,7 @@ from pylib.base import base_test_result
from pylib.constants import host_paths
from pylib.local.device import local_device_environment
from pylib.local.device import local_device_test_run
+from py_trace_event import trace_event
class HeartBeat(object):
@@ -96,8 +97,12 @@ class TestShard(object):
try:
start_time = time.time()
+ if self._test_instance.trace_output:
jbudorick 2016/12/15 20:22:33 My vote would be for a context manager. In relate
jbudorick 2016/12/15 20:22:59 that and tempdir as a context manager.
rnephew (Reviews Here) 2016/12/15 21:24:04 Moved to context manager.
+ trace_event.trace_begin(test)
exit_code, output = cmd_helper.GetCmdStatusAndOutputWithTimeout(
cmd, timeout, cwd=cwd, shell=True)
+ if self._test_instance.trace_output:
+ trace_event.trace_end(test)
end_time = time.time()
json_output = self._test_instance.ReadChartjsonOutput(self._output_dir)
if exit_code == 0:
@@ -410,6 +415,9 @@ class LocalDevicePerfTestRun(local_device_test_run.LocalDeviceTestRun):
#override
def RunTests(self):
# Affinitize the tests.
+ if self._test_instance.trace_output:
+ assert not trace_event.trace_is_enabled(), 'Tracing already running.'
+ trace_event.trace_enable(self._test_instance.trace_output)
self._SplitTestsByAffinity()
if not self._test_buckets and not self._no_device_tests:
raise local_device_test_run.NoTestsError()
@@ -447,6 +455,9 @@ class LocalDevicePerfTestRun(local_device_test_run.LocalDeviceTestRun):
host_test_results, device_test_results = reraiser_thread.RunAsync(
[run_no_devices_tests, run_devices_tests])
+ if self._test_instance.trace_output:
+ assert trace_event.trace_is_enabled(), 'Tracing not running.'
+ trace_event.trace_disable()
return host_test_results + device_test_results
# override

Powered by Google App Engine
This is Rietveld 408576698