Commit f2ed9f80 authored by Changwan Ryu's avatar Changwan Ryu Committed by Commit Bot

Add record_options to run_simpleperf

You can set frequency, duration, recording method, among other things in
record_options. Especially, frequency seems makes some difference
in terms of coverage and accuracy.

Alternative considered: exposing frequency, duration, recording method
separately. There are many other options for record_options, so adding
numerous args would make it too complicated.

Bug: 1015236
Change-Id: I081e95a7f02a3d54dba3b5a0f55291deb309b4bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1946019Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Commit-Queue: Changwan Ryu <changwan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720749}
parent cf41e292
...@@ -150,7 +150,7 @@ class SimplePerfRunner(object): ...@@ -150,7 +150,7 @@ class SimplePerfRunner(object):
def Run(self): def Run(self):
"""Run the simpleperf and do the post processing.""" """Run the simpleperf and do the post processing."""
perf_data_path = os.path.join(self.tmp_dir, 'perf.data') perf_data_path = os.path.join(self.tmp_dir, 'perf.data')
SimplePerfRunner.RunSimplePerf(perf_data_path) SimplePerfRunner.RunSimplePerf(perf_data_path, self.args.record_options)
lines = SimplePerfRunner.GetOriginalReportHtml( lines = SimplePerfRunner.GetOriginalReportHtml(
perf_data_path, perf_data_path,
os.path.join(self.tmp_dir, 'unprocessed_report.html')) os.path.join(self.tmp_dir, 'unprocessed_report.html'))
...@@ -170,13 +170,15 @@ class SimplePerfRunner(object): ...@@ -170,13 +170,15 @@ class SimplePerfRunner(object):
self.args.report_path) self.args.report_path)
@staticmethod @staticmethod
def RunSimplePerf(perf_data_path): def RunSimplePerf(perf_data_path, record_options):
"""Runs the simple perf commandline.""" """Runs the simple perf commandline."""
cmd = ['third_party/android_ndk/simpleperf/app_profiler.py', cmd = ['third_party/android_ndk/simpleperf/app_profiler.py',
'--app', 'org.chromium.webview_shell', '--app', 'org.chromium.webview_shell',
'--activity', '.TelemetryActivity', '--activity', '.TelemetryActivity',
'--perf_data_path', perf_data_path, '--perf_data_path', perf_data_path,
'--skip_collect_binaries'] '--skip_collect_binaries']
if record_options:
cmd.extend(['--record_options', record_options])
subprocess.check_call(cmd) subprocess.check_call(cmd)
def _GetCurrentWebViewProvider(self): def _GetCurrentWebViewProvider(self):
...@@ -251,6 +253,13 @@ def main(raw_args): ...@@ -251,6 +253,13 @@ def main(raw_args):
default='report.html', help='Report path') default='report.html', help='Report path')
parser.add_argument('--adb-path', parser.add_argument('--adb-path',
help='Absolute path to the adb binary to use.') help='Absolute path to the adb binary to use.')
parser.add_argument('--record-options',
help=('Set recording options for app_profiler.py command.'
' Example: "-e task-clock:u -f 1000 -g --duration'
' 10" where -f means sampling frequency per second.'
' Try `app_profiler.py record -h` for more '
' information. Note that not setting this defaults'
' to the default record options.'))
script_common.AddDeviceArguments(parser) script_common.AddDeviceArguments(parser)
logging_common.AddLoggingArguments(parser) logging_common.AddLoggingArguments(parser)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment