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

Unified Diff: systrace/profile_chrome/main.py

Issue 2297403003: Use Systrace tracing controller in profile_chrome (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: Created 4 years, 4 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/profile_chrome/main.py
diff --git a/systrace/profile_chrome/main.py b/systrace/profile_chrome/main.py
index 4abc2d41259dc251798bb03586d8e21aae4d063d..e86bf5c6daf29ae557ad4f2daca501fb5b2b2485 100755
--- a/systrace/profile_chrome/main.py
+++ b/systrace/profile_chrome/main.py
@@ -35,7 +35,7 @@ def _CreateOptionParser():
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',
- type='float')
+ type='float', dest='trace_time')
parser.add_option_group(timed_options)
cont_options = optparse.OptionGroup(parser, 'Continuous tracing')
@@ -61,7 +61,7 @@ def _CreateOptionParser():
parser.add_option('-d', '--device', help='The Android device ID to use, '
'defaults to the value of ANDROID_SERIAL environment '
'variable. If not specified, only 0 or 1 connected '
- 'devices are supported.')
+ 'devices are supported.', dest='device_serial_number')
# Add options from profile_chrome agents.
for module in PROFILE_CHROME_AGENT_MODULES:
@@ -85,9 +85,22 @@ When in doubt, just try out --trace-frame-viewer.
if options.verbose:
logging.getLogger().setLevel(logging.DEBUG)
- device = device_utils.DeviceUtils.HealthyDevices(device_arg=options.device)[0]
+ device = device_utils.DeviceUtils.HealthyDevices(device_arg=
+ options.device_serial_number)[0]
package_info = profiler.GetSupportedBrowsers()[options.browser]
+ options.device = device
+ options.package_info = package_info
+
+ # Add options that are present in Systrace but not in profile_chrome (since
+ # they both use the same tracing controller).
Sami 2016/09/01 12:15:59 I assume this is temporary? Could you add a TODO a
washingtonp 2016/09/01 17:44:41 Done. This reminds me - are you okay with adding t
Sami 2016/09/02 12:57:42 Yeah, that would be great.
washingtonp 2016/09/02 20:10:27 Great! This will be done in the CL that makes prof
+ options.list_categories = None
+ options.link_assets = None
+ options.asset_dir = None
+ options.timeout = None
+ options.collection_timeout = None
+ options.target = None
+
if options.chrome_categories in ['list', 'help']:
ui.PrintMessage('Collecting record categories list...', eol='')
record_categories = []
@@ -118,7 +131,7 @@ When in doubt, just try out --trace-frame-viewer.
perf_tracing_agent.PerfProfilerAgent.GetCategories(device)))
return 0
- if not options.time and not options.continuous:
+ if not options.trace_time and not options.continuous:
ui.PrintMessage('Time interval or continuous tracing should be specified.')
return 1
@@ -126,40 +139,14 @@ When in doubt, just try out --trace-frame-viewer.
logging.warning('Using the "webview" category in atrace together with '
'Chrome tracing results in duplicate trace events.')
- enabled_agents = []
- if options.chrome_categories:
- enabled_agents.append(
- chrome_tracing_agent.ChromeTracingAgent(device,
- package_info,
- options.ring_buffer,
- options.trace_memory))
- if options.atrace_categories:
- enabled_agents.append(
- atrace_tracing_agent.AtraceAgent(device,
- options.ring_buffer))
-
- if options.perf_categories:
- enabled_agents.append(
- perf_tracing_agent.PerfProfilerAgent(device))
-
- if options.ddms:
- enabled_agents.append(
- ddms_tracing_agent.DdmsAgent(device,
- package_info))
-
- if not enabled_agents:
- ui.PrintMessage('No trace categories enabled.')
- return 1
-
- if options.output:
- options.output = os.path.expanduser(options.output)
+ if options.output_file:
+ options.output_file = os.path.expanduser(options.output_file)
result = profiler.CaptureProfile(
options,
- enabled_agents,
- options.time if not options.continuous else 0,
- output=options.output,
+ options.trace_time if not options.continuous else 0,
+ 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))

Powered by Google App Engine
This is Rietveld 408576698