Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
|
borenet
2013/03/12 12:15:38
SVN-copied from generate_bench_graphs.py.
| |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """ Generate performance graphs from bench output. """ | 6 """ Check for regressions in bench data. """ |
| 7 | 7 |
| 8 from build_step import BuildStep | 8 from build_step import BuildStep |
| 9 from utils import bench_common | |
| 10 from utils import shell_utils | 9 from utils import shell_utils |
| 11 from utils import sync_bucket_subdir | |
| 12 | 10 |
| 13 import errno | |
| 14 import os | 11 import os |
| 15 import posixpath | |
| 16 import sys | 12 import sys |
| 17 | 13 |
| 18 | 14 |
| 19 class GenerateBenchGraphs(BuildStep): | 15 class CheckForRegressions(BuildStep): |
| 20 def __init__(self, timeout=600, no_output_timeout=600, **kwargs): | 16 def __init__(self, timeout=600, no_output_timeout=600, **kwargs): |
| 21 super(GenerateBenchGraphs, self).__init__( | 17 super(CheckForRegressions, self).__init__( |
| 22 timeout=timeout, | 18 timeout=timeout, |
| 23 no_output_timeout=no_output_timeout, | 19 no_output_timeout=no_output_timeout, |
| 24 **kwargs) | 20 **kwargs) |
| 25 | 21 |
| 26 def _RunInternal(self, representation): | 22 def _RunInternal(self, representation): |
| 27 try: | |
| 28 os.makedirs(self._perf_graphs_dir) | |
| 29 except OSError as e: | |
| 30 if e.errno == errno.EEXIST: | |
| 31 pass | |
| 32 else: | |
| 33 raise e | |
| 34 dest_gsbase = (self._args.get('dest_gsbase') or | |
| 35 sync_bucket_subdir.DEFAULT_PERFDATA_GS_BASE) | |
| 36 | |
| 37 path_to_bench_graph_svg = os.path.join('bench', 'bench_graph_svg.py') | 23 path_to_bench_graph_svg = os.path.join('bench', 'bench_graph_svg.py') |
| 38 path_to_bench_expectations = os.path.join('bench', | 24 path_to_bench_expectations = os.path.join('bench', |
| 39 'bench_expectations.txt') | 25 'bench_expectations.txt') |
| 40 graph_title = 'Bench_Performance_for_%s' % self._builder_name | 26 graph_title = 'Bench_Performance_for_%s' % self._builder_name |
| 41 graph_filepath = bench_common.GraphFilePath(self._perf_graphs_dir, | |
| 42 self._builder_name, | |
| 43 representation) | |
| 44 sync_bucket_subdir.SyncBucketSubdir(directory=self._perf_data_dir, | |
| 45 dest_gsbase=dest_gsbase, | |
| 46 subdir=posixpath.join('perfdata', self._builder_name), | |
| 47 do_upload=False, | |
| 48 do_download=True, | |
| 49 min_download_revision=self._got_revision - | |
| 50 bench_common.BENCH_GRAPH_NUM_REVISIONS) | |
| 51 | |
| 52 cmd = ['python', path_to_bench_graph_svg, | 27 cmd = ['python', path_to_bench_graph_svg, |
|
epoger
2013/03/12 15:58:33
Maybe add a comment like this?
Run bench_graph_sv
| |
| 53 '-d', self._perf_data_dir, | 28 '-d', self._perf_data_dir, |
| 54 '-e', path_to_bench_expectations, | 29 '-e', path_to_bench_expectations, |
| 55 '-r', '-%d' % bench_common.BENCH_GRAPH_NUM_REVISIONS, | 30 '-r', '-1', |
| 56 '-f', '-%d' % bench_common.BENCH_GRAPH_NUM_REVISIONS, | 31 '-f', '-1', |
| 57 '-x', '%d' % bench_common.BENCH_GRAPH_X, | |
| 58 '-y', '%d' % bench_common.BENCH_GRAPH_Y, | |
| 59 '-l', graph_title, | 32 '-l', graph_title, |
| 60 '-m', representation, | 33 '-m', representation, |
| 61 '-o', graph_filepath, | |
| 62 ] | 34 ] |
| 63 if self._builder_name.find('_Win') >= 0: | 35 if self._builder_name.find('_Win') >= 0: |
| 64 cmd.extend(['-i', 'c']) # Ignore cpu time for Windows. | 36 cmd.extend(['-i', 'c']) # Ignore cpu time for Windows. |
| 65 | 37 |
| 66 shell_utils.Bash(cmd) | 38 shell_utils.Bash(cmd) |
| 67 | 39 |
| 68 def _Run(self): | 40 def _Run(self): |
| 69 if self._perf_data_dir: | 41 if self._perf_data_dir: |
| 70 for rep in ['avg', 'min', 'med', '25th']: | 42 for rep in ['avg', 'min', 'med', '25th']: |
| 71 self._RunInternal(rep) | 43 self._RunInternal(rep) |
| 72 | 44 |
| 73 | 45 |
| 74 if '__main__' == __name__: | 46 if '__main__' == __name__: |
| 75 sys.exit(BuildStep.RunBuildStep(GenerateBenchGraphs)) | 47 sys.exit(BuildStep.RunBuildStep(CheckForRegressions)) |
| OLD | NEW |