OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
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 """ Generate performance graphs from bench output. """ |
7 | 7 |
8 from build_step import BuildStep | 8 from build_step import BuildStep |
9 from utils import bench_common | 9 from utils import bench_common |
10 from utils import shell_utils | 10 from utils import shell_utils |
(...skipping 17 matching lines...) Expand all Loading... |
28 os.makedirs(self._perf_graphs_dir) | 28 os.makedirs(self._perf_graphs_dir) |
29 except OSError as e: | 29 except OSError as e: |
30 if e.errno == errno.EEXIST: | 30 if e.errno == errno.EEXIST: |
31 pass | 31 pass |
32 else: | 32 else: |
33 raise e | 33 raise e |
34 dest_gsbase = (self._args.get('dest_gsbase') or | 34 dest_gsbase = (self._args.get('dest_gsbase') or |
35 sync_bucket_subdir.DEFAULT_PERFDATA_GS_BASE) | 35 sync_bucket_subdir.DEFAULT_PERFDATA_GS_BASE) |
36 | 36 |
37 path_to_bench_graph_svg = os.path.join('bench', 'bench_graph_svg.py') | 37 path_to_bench_graph_svg = os.path.join('bench', 'bench_graph_svg.py') |
38 path_to_bench_expectations = os.path.join('bench', | |
39 'bench_expectations.txt') | |
40 graph_title = 'Bench_Performance_for_%s' % self._builder_name | 38 graph_title = 'Bench_Performance_for_%s' % self._builder_name |
41 graph_filepath = bench_common.GraphFilePath(self._perf_graphs_dir, | 39 graph_filepath = bench_common.GraphFilePath(self._perf_graphs_dir, |
42 self._builder_name, | 40 self._builder_name, |
43 representation) | 41 representation) |
44 sync_bucket_subdir.SyncBucketSubdir(directory=self._perf_data_dir, | 42 sync_bucket_subdir.SyncBucketSubdir(directory=self._perf_data_dir, |
45 dest_gsbase=dest_gsbase, | 43 dest_gsbase=dest_gsbase, |
46 subdir=posixpath.join('perfdata', self._builder_name), | 44 subdir=posixpath.join('perfdata', self._builder_name), |
47 do_upload=False, | 45 do_upload=False, |
48 do_download=True, | 46 do_download=True, |
49 min_download_revision=self._got_revision - | 47 min_download_revision=self._got_revision - |
50 bench_common.BENCH_GRAPH_NUM_REVISIONS) | 48 bench_common.BENCH_GRAPH_NUM_REVISIONS) |
51 | 49 |
52 cmd = ['python', path_to_bench_graph_svg, | 50 cmd = ['python', path_to_bench_graph_svg, |
53 '-d', self._perf_data_dir, | 51 '-d', self._perf_data_dir, |
54 '-e', path_to_bench_expectations, | |
55 '-r', '-%d' % bench_common.BENCH_GRAPH_NUM_REVISIONS, | 52 '-r', '-%d' % bench_common.BENCH_GRAPH_NUM_REVISIONS, |
56 '-f', '-%d' % bench_common.BENCH_GRAPH_NUM_REVISIONS, | 53 '-f', '-%d' % bench_common.BENCH_GRAPH_NUM_REVISIONS, |
57 '-x', '%d' % bench_common.BENCH_GRAPH_X, | 54 '-x', '%d' % bench_common.BENCH_GRAPH_X, |
58 '-y', '%d' % bench_common.BENCH_GRAPH_Y, | 55 '-y', '%d' % bench_common.BENCH_GRAPH_Y, |
59 '-l', graph_title, | 56 '-l', graph_title, |
60 '-m', representation, | 57 '-m', representation, |
61 '-o', graph_filepath, | 58 '-o', graph_filepath, |
62 ] | 59 ] |
63 if self._builder_name.find('_Win') >= 0: | 60 if self._builder_name.find('_Win') >= 0: |
64 cmd.extend(['-i', 'c']) # Ignore cpu time for Windows. | 61 cmd.extend(['-i', 'c']) # Ignore cpu time for Windows. |
65 | 62 |
66 shell_utils.Bash(cmd) | 63 shell_utils.Bash(cmd) |
67 | 64 |
68 def _Run(self): | 65 def _Run(self): |
69 if self._perf_data_dir: | 66 if self._perf_data_dir: |
70 for rep in ['avg', 'min', 'med', '25th']: | 67 for rep in ['avg', 'min', 'med', '25th']: |
71 self._RunInternal(rep) | 68 self._RunInternal(rep) |
72 | 69 |
73 | 70 |
74 if '__main__' == __name__: | 71 if '__main__' == __name__: |
75 sys.exit(BuildStep.RunBuildStep(GenerateBenchGraphs)) | 72 sys.exit(BuildStep.RunBuildStep(GenerateBenchGraphs)) |
OLD | NEW |