| Index: systrace/profile_chrome/profiler.py
|
| diff --git a/systrace/profile_chrome/profiler.py b/systrace/profile_chrome/profiler.py
|
| index 1a4009ca7355c76c50cd8046f8451c57c3c52426..625c086346afb6d64708629dcc6d5c9503150c0c 100644
|
| --- a/systrace/profile_chrome/profiler.py
|
| +++ b/systrace/profile_chrome/profiler.py
|
| @@ -2,13 +2,13 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| +import json
|
| import time
|
|
|
| from profile_chrome import chrome_startup_tracing_agent
|
| from profile_chrome import chrome_tracing_agent
|
| from profile_chrome import ui
|
| from profile_chrome import util
|
| -from systrace import output_generator
|
| from systrace import tracing_controller
|
|
|
|
|
| @@ -23,37 +23,33 @@ def _GetResults(trace_results, controller, output, compress, write_json,
|
| if isinstance(agent, chrome_tracing_agent.ChromeTracingAgent):
|
| time.sleep(interval / 4)
|
|
|
| - # Ignore the systraceController because it will not contain any results,
|
| - # instead being in charge of collecting results.
|
| - trace_results = [x for x in controller.all_results if not (x.source_name ==
|
| - 'systraceController')]
|
| + trace_results = controller.all_results
|
|
|
| if not trace_results:
|
| ui.PrintMessage('No results')
|
| return ''
|
|
|
| result = None
|
| - trace_results = output_generator.MergeTraceResultsIfNeeded(trace_results)
|
| + trace_name = 'profile_chrome'
|
| +
|
| if not write_json:
|
| ui.PrintMessage('Writing trace HTML...')
|
| - html_file = trace_results[0].source_name + '.html'
|
| - result = output_generator.GenerateHTMLOutput(trace_results, html_file)
|
| + html_file = trace_name + '.html'
|
| + trace_results.Serialize(html_file, 'Profile Chrome')
|
| + result = html_file
|
| ui.PrintMessage('\nWrote file://%s' % result)
|
| - elif compress and len(trace_results) == 1:
|
| - result = output or trace_results[0].source_name + '.gz'
|
| - util.WriteDataToCompressedFile(trace_results[0].raw_data, result)
|
| - elif len(trace_results) > 1:
|
| - result = (output or 'chrome-combined-trace-%s.zip' %
|
| - util.GetTraceTimestamp())
|
| - util.ArchiveData(trace_results, result)
|
| + elif compress:
|
| + result = output or trace_name + '.gz'
|
| + util.WriteDataToCompressedFile(trace_results._raw_data, result)
|
| elif output:
|
| result = output
|
| with open(result, 'wb') as f:
|
| - f.write(trace_results[0].raw_data)
|
| + json.dump(trace_results._raw_data, f, indent=4,
|
| + separators=(',', ':'))
|
| else:
|
| - result = trace_results[0].source_name
|
| + result = trace_name + '.json'
|
| with open(result, 'wb') as f:
|
| - f.write(trace_results[0].raw_data)
|
| + json.dump(trace_results._raw_data, f, indent=4, separators=(',', ':'))
|
|
|
| return result
|
|
|
|
|