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

Side by Side Diff: mojo/devtools/common/mojo_benchmark

Issue 1964903002: Disable output buffering in devtools scripts. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Runner for Mojo application benchmarks.""" 6 """Runner for Mojo application benchmarks."""
7 7
8 import argparse 8 import argparse
9 import logging 9 import logging
10 import numpy 10 import numpy
11 import sys 11 import sys
12 import time 12 import time
13 13
14 from devtoolslib import benchmark 14 from devtoolslib import benchmark
15 from devtoolslib import perf_dashboard 15 from devtoolslib import perf_dashboard
16 from devtoolslib import shell_arguments 16 from devtoolslib import shell_arguments
17 from devtoolslib import shell_config 17 from devtoolslib import shell_config
18 from devtoolslib.utils import disable_output_buffering
18 19
19 20
20 _DESCRIPTION = """Runner for Mojo application benchmarks. 21 _DESCRIPTION = """Runner for Mojo application benchmarks.
21 22
22 |benchmark_list_file| has to be a valid Python program that sets a |benchmarks| 23 |benchmark_list_file| has to be a valid Python program that sets a |benchmarks|
23 dictionary. For description of the required format see 24 dictionary. For description of the required format see
24 https://github.com/domokit/devtools/blob/master/docs/mojo_benchmark.md . 25 https://github.com/domokit/devtools/blob/master/docs/mojo_benchmark.md .
25 """ 26 """
26 27
27 _logger = logging.getLogger() 28 _logger = logging.getLogger()
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 cast_value = int(value) 139 cast_value = int(value)
139 except ValueError: 140 except ValueError:
140 raise argparse.ArgumentTypeError('value is not a positive integer') 141 raise argparse.ArgumentTypeError('value is not a positive integer')
141 142
142 if cast_value < 1: 143 if cast_value < 1:
143 raise argparse.ArgumentTypeError('value is not a positive integer') 144 raise argparse.ArgumentTypeError('value is not a positive integer')
144 return cast_value 145 return cast_value
145 146
146 147
147 def main(): 148 def main():
149 disable_output_buffering()
148 parser = argparse.ArgumentParser( 150 parser = argparse.ArgumentParser(
149 formatter_class=argparse.RawDescriptionHelpFormatter, 151 formatter_class=argparse.RawDescriptionHelpFormatter,
150 description=_DESCRIPTION) 152 description=_DESCRIPTION)
151 parser.add_argument('benchmark_list_file', type=file, 153 parser.add_argument('benchmark_list_file', type=file,
152 help='a file listing benchmarks to run') 154 help='a file listing benchmarks to run')
153 parser.add_argument('--aggregate', type=_argparse_aggregate_type, 155 parser.add_argument('--aggregate', type=_argparse_aggregate_type,
154 help='aggregate results over multiple runs. The value ' 156 help='aggregate results over multiple runs. The value '
155 'has to be a positive integer indicating the number of ' 157 'has to be a positive integer indicating the number of '
156 'runs.') 158 'runs.')
157 parser.add_argument('--save-all-traces', action='store_true', 159 parser.add_argument('--save-all-traces', action='store_true',
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 variant_results[variant_name], 224 variant_results[variant_name],
223 variant_spec['measurements'], 225 variant_spec['measurements'],
224 script_args) 226 script_args)
225 if not upload_succeeded: 227 if not upload_succeeded:
226 exit_code = 1 228 exit_code = 1
227 229
228 return exit_code 230 return exit_code
229 231
230 if __name__ == '__main__': 232 if __name__ == '__main__':
231 sys.exit(main()) 233 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698