| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 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 """ Run the Skia bench_pictures executable. """ | 6 """ Run the Skia bench_pictures executable. """ |
| 7 | 7 |
| 8 import os |
| 9 import sys |
| 10 |
| 8 from build_step import BuildStep | 11 from build_step import BuildStep |
| 9 from run_bench import BenchArgs | 12 from run_bench import BenchArgs |
| 10 import os | 13 from utils import gclient_utils |
| 11 import sys | |
| 12 | 14 |
| 13 | 15 |
| 14 BENCH_REPEAT_COUNT = 10 | 16 BENCH_REPEAT_COUNT = 10 |
| 15 | 17 |
| 16 | 18 |
| 17 class BenchPictures(BuildStep): | 19 class BenchPictures(BuildStep): |
| 18 def __init__(self, timeout=16800, no_output_timeout=16800, **kwargs): | 20 def __init__(self, timeout=16800, no_output_timeout=16800, **kwargs): |
| 19 super(BenchPictures, self).__init__(timeout=timeout, | 21 super(BenchPictures, self).__init__(timeout=timeout, |
| 20 no_output_timeout=no_output_timeout, | 22 no_output_timeout=no_output_timeout, |
| 21 **kwargs) | 23 **kwargs) |
| 22 | 24 |
| 23 # pylint: disable=W0221 | 25 # pylint: disable=W0221 |
| 24 def _BuildDataFile(self, args): | 26 def _BuildDataFile(self, args): |
| 25 filename = '_'.join(['bench', self._got_revision, | 27 filename = '_'.join(['bench', self._got_revision, |
| 26 'data', 'skp'] + args) | 28 'data', 'skp'] + args) |
| 27 full_path = os.path.join(self._device_dirs.PerfDir(), | 29 full_path = os.path.join(self._device_dirs.PerfDir(), |
| 28 filename.replace('-', '').replace(':', '-')) | 30 filename.replace('-', '').replace(':', '-')) |
| 29 return full_path | 31 return full_path |
| 30 | 32 |
| 33 def _BuildJSONDataFile(self, args): |
| 34 git_timestamp = gclient_utils.GetGitRepoPOSIXTimestamp() |
| 35 return '{}_{}.json'.format( |
| 36 self._BuildDataFile(args), |
| 37 git_timestamp) |
| 38 |
| 31 def _DoBenchPictures(self, args): | 39 def _DoBenchPictures(self, args): |
| 32 arguments = ['-r', self._device_dirs.SKPDir()] + args | 40 arguments = ['-r', self._device_dirs.SKPDir()] + args |
| 33 if self._perf_data_dir: | 41 if self._perf_data_dir: |
| 34 arguments.extend(BenchArgs(data_file=self._BuildDataFile(args))) | 42 arguments.extend(BenchArgs(data_file=self._BuildDataFile(args))) |
| 43 arguments.extend(['--jsonLog', self._BuildJSONDataFile(args)]) |
| 35 # For bench_pictures we use the --repeat and --logPerIter flags so that we | 44 # For bench_pictures we use the --repeat and --logPerIter flags so that we |
| 36 # can compensate for noisy performance. | 45 # can compensate for noisy performance. |
| 37 arguments.extend(['--repeat', str(BENCH_REPEAT_COUNT), '--logPerIter']) | 46 arguments.extend(['--repeat', str(BENCH_REPEAT_COUNT), '--logPerIter']) |
| 38 self._flavor_utils.RunFlavoredCmd('bench_pictures', arguments) | 47 self._flavor_utils.RunFlavoredCmd('bench_pictures', arguments) |
| 39 | 48 |
| 40 def _Run(self): | 49 def _Run(self): |
| 41 # Determine which configs to run | 50 # Determine which configs to run |
| 42 if self._configuration == 'Debug': | 51 if self._configuration == 'Debug': |
| 43 cfg_name = 'debug' | 52 cfg_name = 'debug' |
| 44 else: | 53 else: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 71 self._DoBenchPictures(args) | 80 self._DoBenchPictures(args) |
| 72 except Exception as e: | 81 except Exception as e: |
| 73 print e | 82 print e |
| 74 errors.append(e) | 83 errors.append(e) |
| 75 if errors: | 84 if errors: |
| 76 raise errors[0] | 85 raise errors[0] |
| 77 | 86 |
| 78 | 87 |
| 79 if '__main__' == __name__: | 88 if '__main__' == __name__: |
| 80 sys.exit(BuildStep.RunBuildStep(BenchPictures)) | 89 sys.exit(BuildStep.RunBuildStep(BenchPictures)) |
| OLD | NEW |