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

Unified Diff: systrace/systrace/systrace_runner.py

Issue 2712163002: [Systrace] Fix systrace clock syncing issue with BattOr. (Closed)
Patch Set: Created 3 years, 10 months 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: systrace/systrace/systrace_runner.py
diff --git a/systrace/systrace/systrace_runner.py b/systrace/systrace/systrace_runner.py
index c3452d10e4983bbbbfacc773e2b5a96eaf03a10b..209a29c2ae82b628c4ba7adfd850e47a9e860b32 100644
--- a/systrace/systrace/systrace_runner.py
+++ b/systrace/systrace/systrace_runner.py
@@ -8,7 +8,8 @@
necessary tracing agents for systrace, runs them, and outputs the results
as an HTML or JSON file.'''
-from systrace import output_generator
+import json
+
from systrace import tracing_controller
from systrace.tracing_agents import atrace_agent
from systrace.tracing_agents import atrace_from_file_agent
@@ -35,6 +36,8 @@ class SystraceRunner(object):
agents_with_config = tracing_controller.CreateAgentsWithConfig(
options, AGENT_MODULES)
controller_config = tracing_controller.GetControllerConfig(options)
+ self._trace_data = None
+
# Set up tracing controller.
self._tracing_controller = tracing_controller.TracingController(
@@ -44,7 +47,7 @@ class SystraceRunner(object):
self._tracing_controller.StartTracing()
def StopTracing(self):
- self._tracing_controller.StopTracing()
+ self._trace_data = self._tracing_controller.StopTracing()
def OutputSystraceResults(self, write_json=False):
"""Output the results of systrace to a file.
@@ -58,12 +61,9 @@ class SystraceRunner(object):
"""
print 'Tracing complete, writing results'
if write_json:
- result = output_generator.GenerateJSONOutput(
- self._tracing_controller.all_results,
- self._out_filename)
- else:
- result = output_generator.GenerateHTMLOutput(
- self._tracing_controller.all_results,
- self._out_filename)
- print '\nWrote trace %s file: file://%s\n' % (('JSON' if write_json
- else 'HTML'), result)
+ with open(self._out_filename+'.json', 'w') as json_file:
+ json.dump(self._trace_data._raw_data, json_file, indent=4,
+ separators=(',', ':'))
+ print '\nWrote trace as json to %s' % self._out_filename+'.json'
+ self._trace_data.Serialize(self._out_filename, 'Systrace Trace')
+ print '\nWrote trace html file to %s' % self._out_filename

Powered by Google App Engine
This is Rietveld 408576698