Index: systrace/bin/adb_profile_chrome_startup |
diff --git a/systrace/bin/adb_profile_chrome_startup b/systrace/bin/adb_profile_chrome_startup |
index 80a266bfd2272c735466acbaed728a8b6284e2c1..afccdbb81e8a934359a363207264ccc61e878823 100755 |
--- a/systrace/bin/adb_profile_chrome_startup |
+++ b/systrace/bin/adb_profile_chrome_startup |
@@ -26,6 +26,11 @@ sys.path.append(os.path.join(_CATAPULT_DIR, 'devil')) |
from devil.android import device_utils |
+CHROME_STARTUP_MODULES = [atrace_tracing_agent, |
Zhen Wang
2016/09/07 16:37:11
This should be private if it is not used by other
washingtonp
2016/09/07 18:36:08
Done.
|
+ chrome_startup_tracing_agent] |
+_DEFAULT_CHROME_CATEGORIES = '_DEFAULT_CHROME_CATEGORIES' |
+ |
+ |
def _CreateOptionParser(): |
parser = optparse.OptionParser(description='Record about://tracing profiles ' |
'from Android browsers startup, combined with ' |
@@ -45,7 +50,7 @@ def _CreateOptionParser(): |
'with gzip. ', action='store_true') |
parser.add_option('-t', '--time', help='Stops tracing after N seconds, 0 to ' |
'manually stop (startup trace ends after at most 5s).', |
- default=5, metavar='N', type='int') |
+ default=5, metavar='N', type='int', dest='trace_time') |
parser.add_option_group(chrome_startup_tracing_agent.add_options(parser)) |
parser.add_option_group(atrace_tracing_agent.add_options(parser)) |
@@ -68,29 +73,26 @@ def main(): |
device = devices[0] |
package_info = profiler.GetSupportedBrowsers()[options.browser] |
+ options.device = device |
+ options.package_info = package_info |
+ |
+ # TODO(washingtonp): Once Systrace uses all of the profile_chrome agents, |
+ # manually setting these options will no longer be necessary and should be |
+ # removed. |
+ options.ring_buffer = False |
+ options.trace_memory = False |
+ options.chrome_categories = _DEFAULT_CHROME_CATEGORIES |
+ |
if options.atrace_categories in ['list', 'help']: |
ui.PrintMessage('\n'.join( |
atrace_tracing_agent.AtraceAgent.GetCategories(device))) |
return 0 |
- atrace_categories = (options.atrace_categories.split(',') |
- if options.atrace_categories else []) |
- enabled_agents = [] |
- # Enable the atrace and chrome agents. The atrace agent should go |
- # first because otherwise the resulting traces miss early atrace data. |
- if atrace_categories: |
- enabled_agents.append(atrace_tracing_agent.AtraceAgent( |
- device, atrace_categories, False)) |
- enabled_agents.append( |
- chrome_startup_tracing_agent.ChromeStartupTracingAgent( |
- device, package_info, options.cold, options.url)) |
- if options.output: |
- options.output = os.path.expanduser(options.output) |
result = profiler.CaptureProfile(options, |
- enabled_agents, |
- options.time, |
- output=options.output, |
+ options.trace_time, |
+ CHROME_STARTUP_MODULES, |
+ output=options.output_file, |
compress=options.compress, |
- write_json=options.json) |
+ write_json=options.write_json) |
if options.view: |
if sys.platform == 'darwin': |
os.system('/usr/bin/open %s' % os.path.abspath(result)) |