| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """Run the Skia benchmarking executable.""" | |
| 7 | |
| 8 import os | |
| 9 import sys | |
| 10 | |
| 11 from build_step import BuildStep | |
| 12 from utils import gclient_utils | |
| 13 | |
| 14 import builder_name_schema | |
| 15 | |
| 16 class RunNanobench(BuildStep): | |
| 17 """A BuildStep that runs nanobench.""" | |
| 18 | |
| 19 def __init__(self, timeout=9600, no_output_timeout=9600, **kwargs): | |
| 20 super(RunNanobench, self).__init__(timeout=timeout, | |
| 21 no_output_timeout=no_output_timeout, | |
| 22 **kwargs) | |
| 23 | |
| 24 def _KeyParams(self): | |
| 25 """Build a unique key from the builder name (as a list). | |
| 26 | |
| 27 E.g.: os Mac10.6 model MacMini4.1 gpu GeForce320M arch x86 | |
| 28 | |
| 29 This info is used by nanobench in its JSON output. | |
| 30 """ | |
| 31 params = builder_name_schema.DictForBuilderName(self._builder_name) | |
| 32 blacklist = ['configuration', 'role', 'is_trybot'] | |
| 33 # Don't include role (always Perf) or configuration (always Release). | |
| 34 # TryBots can use the same exact key as they are uploaded to a different | |
| 35 # location. | |
| 36 # | |
| 37 # It would be great to simplify this even further, but right now we have | |
| 38 # two models for the same GPU (eg. GalaxyNexus/NexusS for SGX540) and two | |
| 39 # gpus for the same model (ShuttleA for GTX660/HD7770). | |
| 40 for name in blacklist: | |
| 41 if name in params: | |
| 42 del params[name] | |
| 43 flat = [] | |
| 44 for k in sorted(params.keys()): | |
| 45 flat.append(k) | |
| 46 flat.append(params[k]) | |
| 47 return flat | |
| 48 | |
| 49 def _JSONPath(self): | |
| 50 git_timestamp = gclient_utils.GetGitRepoPOSIXTimestamp() | |
| 51 return os.path.join( | |
| 52 self._device_dirs.PerfDir(), | |
| 53 'nanobench_%s_%s.json' % ( self._got_revision, git_timestamp)) | |
| 54 | |
| 55 def _AnyMatch(self, *args): | |
| 56 return any(arg in self._builder_name for arg in args) | |
| 57 | |
| 58 def _Run(self): | |
| 59 args = ['-i', self._device_dirs.ResourceDir(), | |
| 60 '--skps', self._device_dirs.SKPDir(), | |
| 61 '--scales', '1.0', '1.1'] | |
| 62 if self._AnyMatch('Valgrind'): | |
| 63 args.extend(['--loops', '1']) # Don't care about performance on Valgrind. | |
| 64 elif self._perf_data_dir: | |
| 65 args.extend(['--outResultsFile', self._JSONPath()]) | |
| 66 args.append('--key') | |
| 67 args.extend(self._KeyParams()) | |
| 68 args.append('--properties') | |
| 69 args.extend(['gitHash', self._got_revision, | |
| 70 'build_number', str(self._build_number)]) | |
| 71 | |
| 72 match = [] | |
| 73 # Disable known problems. | |
| 74 if self._AnyMatch('Android'): | |
| 75 # Segfaults when run as GPU bench. Very large texture? | |
| 76 match.append('~blurroundrect') | |
| 77 match.append('~patch_grid') # skia:2847 | |
| 78 | |
| 79 if self._AnyMatch('HD2000'): | |
| 80 match.extend(['~gradient', '~etc1bitmap']) # skia:2895 | |
| 81 | |
| 82 if self._AnyMatch('Xoom', 'Venue8'): # skia:2934 | |
| 83 match.append('~desk_carsvg') | |
| 84 | |
| 85 if self._AnyMatch('Nexus7'): | |
| 86 match = ['skp'] # skia:2774 | |
| 87 | |
| 88 if match: | |
| 89 args.append('--match') | |
| 90 args.extend(match) | |
| 91 | |
| 92 self._flavor_utils.RunFlavoredCmd('nanobench', args) | |
| 93 | |
| 94 # See skia:2789 | |
| 95 if self._AnyMatch('Valgrind'): | |
| 96 abandonGpuContext = list(args) | |
| 97 abandonGpuContext.append('--abandonGpuContext') | |
| 98 abandonGpuContext.append('--nocpu') | |
| 99 self._flavor_utils.RunFlavoredCmd('nanobench', abandonGpuContext) | |
| 100 | |
| 101 | |
| 102 if '__main__' == __name__: | |
| 103 sys.exit(BuildStep.RunBuildStep(RunNanobench)) | |
| OLD | NEW |