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

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: Fix presubmit 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
« no previous file with comments | « build/android/pylib/__init__.py ('k') | build/android/pylib/perf/perf_test_instance.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e8e612c2f7914b3a7898c83c115b50a07425e476 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:
+ trace_event.trace_begin(test)
jbudorick 2016/12/15 20:12:22 Isn't there a context manager version of this? Can
rnephew (Reviews Here) 2016/12/15 20:16:42 I originally was using trace_event.trace(name) but
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,10 @@ 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)
+ assert trace_event.trace_is_enabled(), 'Tracing didn\'t enable properly.'
jbudorick 2016/12/15 20:12:22 Double quotes around strings that contain single q
rnephew (Reviews Here) 2016/12/15 20:16:42 Acknowledged. This message is gone now.
self._SplitTestsByAffinity()
if not self._test_buckets and not self._no_device_tests:
raise local_device_test_run.NoTestsError()
@@ -447,6 +456,10 @@ 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()
+ assert not trace_event.trace_is_enabled(), 'Tracing not disabled.'
return host_test_results + device_test_results
# override
« no previous file with comments | « build/android/pylib/__init__.py ('k') | build/android/pylib/perf/perf_test_instance.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698