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

Unified Diff: mojo/devtools/common/mojo_benchmark

Issue 1347063002: Teach `benchmark.mojo` to save the collected trace file to disk. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « apps/benchmark/run_args.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/devtools/common/mojo_benchmark
diff --git a/mojo/devtools/common/mojo_benchmark b/mojo/devtools/common/mojo_benchmark
index 756b44ba101f5ec830a4a4397c7cb885b971463c..a8191f5ee9a50ff4f6d9a532a6e183c277a66239 100755
--- a/mojo/devtools/common/mojo_benchmark
+++ b/mojo/devtools/common/mojo_benchmark
@@ -8,6 +8,7 @@
import argparse
import logging
import sys
+import time
from devtoolslib import shell_arguments
from devtoolslib import shell_config
@@ -52,7 +53,7 @@ _EXTRA_TIMEOUT = 20
def _run_benchmark(shell, shell_args, name, app, duration_seconds, measurements,
- cold_start, verbose):
+ cold_start, verbose, save_traces):
"""Runs `benchmark.mojo` in shell with correct arguments, parses and
presents the benchmark results.
"""
@@ -60,6 +61,13 @@ def _run_benchmark(shell, shell_args, name, app, duration_seconds, measurements,
benchmark_args = []
benchmark_args.append('--app=' + app)
benchmark_args.append('--duration=' + str(duration_seconds))
+ if save_traces:
+ trace_output_file = 'benchmark-%s-%s-%s.trace' % (
+ name.replace(' ', '_'),
+ 'cold_start' if cold_start else 'warm_start',
+ time.strftime('%Y%m%d%H%M%S'))
+ benchmark_args.append('--trace-output=' + trace_output_file)
+
for measurement in measurements:
benchmark_args.append(measurement)
@@ -100,6 +108,8 @@ def main():
description=_DESCRIPTION)
parser.add_argument('benchmark_list_file', type=file,
help='a file listing benchmarks to run')
+ parser.add_argument('--save-traces', action='store_true',
+ help='save the traces produced by benchmarks to disk')
# Common shell configuration arguments.
shell_config.add_shell_arguments(parser)
@@ -125,9 +135,11 @@ def main():
shell_args = benchmark_spec.get('shell-args', []) + common_shell_args
measurements = benchmark_spec['measurements']
_run_benchmark(shell, shell_args, name, app, duration, measurements,
- cold_start=True, verbose=script_args.verbose)
+ cold_start=True, verbose=script_args.verbose,
+ save_traces=script_args.save_traces)
_run_benchmark(shell, shell_args, name, app, duration, measurements,
- cold_start=False, verbose=script_args.verbose)
+ cold_start=False, verbose=script_args.verbose,
+ save_traces=script_args.save_traces)
return 0 if succeeded else 1
« no previous file with comments | « apps/benchmark/run_args.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698