Index: tools/profile_chrome/main.py |
diff --git a/tools/profile_chrome/main.py b/tools/profile_chrome/main.py |
index 1dbf08a60d9e98cf67ca6f21cebc369988aaf689..2a7af95dd7c95674818bf0825052c852185ada59 100755 |
--- a/tools/profile_chrome/main.py |
+++ b/tools/profile_chrome/main.py |
@@ -74,6 +74,12 @@ def _CreateOptionParser(): |
'profiling-tool for detailed instructions for ' |
'profiling.') |
+ parser.add_option('--startup', help='Trace Chrome Startup. Possible values ' |
+ 'are "warm" and "cold". The "warm" start does not perform ' |
+ 'special steps, while the "cols" flushes the OS page cache ' |
+ 'before start. Note that "cold" requires a device with root' |
+ ' access.', default=None, choices=['warm', 'cold']) |
+ |
timed_options = optparse.OptionGroup(parser, 'Timed tracing') |
timed_options.add_option('-t', '--time', help='Profile for N seconds and ' |
'download the resulting trace.', metavar='N', |
@@ -210,8 +216,9 @@ When in doubt, just try out --trace-frame-viewer. |
perf_controller.PerfProfilerController.GetCategories(device))) |
return 0 |
- if not options.time and not options.continuous: |
- ui.PrintMessage('Time interval or continuous tracing should be specified.') |
+ if not options.time and not options.continuous and not options.startup: |
+ ui.PrintMessage('Time interval, continuous or startup tracing should be ' |
+ 'specified.') |
return 1 |
chrome_categories = _ComputeChromeCategories(options) |
@@ -223,19 +230,22 @@ When in doubt, just try out --trace-frame-viewer. |
'Chrome tracing results in duplicate trace events.') |
enabled_controllers = [] |
- if chrome_categories: |
- enabled_controllers.append( |
- chrome_controller.ChromeTracingController(device, |
- package_info, |
- chrome_categories, |
- options.ring_buffer, |
- options.trace_memory)) |
+ # Enable the systrace and chrome controller. The systrace controller should go |
+ # first because it provides early events used in the chrome controller. |
if systrace_categories: |
enabled_controllers.append( |
systrace_controller.SystraceController(device, |
systrace_categories, |
options.ring_buffer)) |
+ if chrome_categories: |
+ enabled_controllers.append( |
+ chrome_controller.ChromeTracingController(device, |
+ package_info, |
+ chrome_categories, |
+ options.ring_buffer, |
+ options.trace_memory, |
+ options.startup)) |
if perf_categories: |
enabled_controllers.append( |
perf_controller.PerfProfilerController(device, |
@@ -249,7 +259,7 @@ When in doubt, just try out --trace-frame-viewer. |
options.output = os.path.expanduser(options.output) |
result = profiler.CaptureProfile( |
enabled_controllers, |
- options.time if not options.continuous else 0, |
+ options.time if options.time else 0, |
output=options.output, |
compress=options.compress, |
write_json=options.json) |