OLD | NEW |
| (Empty) |
1 # | |
2 # Copyright 2015 Google Inc. | |
3 # | |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 # | |
7 | |
8 #!/usr/bin/env python | |
9 | |
10 usage = ''' | |
11 Write extra flags to outfile for nanobench based on the bot name: | |
12 $ python nanobench_flags.py outfile Perf-Android-GCC-GalaxyS3-GPU-Mali400-Arm7
-Release | |
13 Or run self-tests: | |
14 $ python nanobench_flags.py test | |
15 ''' | |
16 | |
17 import inspect | |
18 import json | |
19 import os | |
20 import sys | |
21 | |
22 | |
23 def lineno(): | |
24 caller = inspect.stack()[1] # Up one level to our caller. | |
25 return inspect.getframeinfo(caller[0]).lineno | |
26 | |
27 | |
28 cov_start = lineno()+1 # We care about coverage starting just past this def. | |
29 def get_args(bot): | |
30 args = ['--pre_log'] | |
31 | |
32 if 'GPU' in bot: | |
33 args.append('--images') | |
34 args.extend(['--gpuStatsDump', 'true']) | |
35 | |
36 if 'Android' in bot and 'GPU' in bot: | |
37 args.extend(['--useThermalManager', '1,1,10,1000']) | |
38 | |
39 args.extend(['--scales', '1.0', '1.1']) | |
40 | |
41 if 'iOS' in bot: | |
42 args.extend(['--skps', 'ignore_skps']) | |
43 | |
44 config = ['565', '8888', 'gpu', 'nonrendering', 'angle', 'hwui' ] | |
45 config += [ 'f16', 'srgb' ] | |
46 # The S4 crashes and the NP produces a long error stream when we run with | |
47 # MSAA. | |
48 if ('GalaxyS4' not in bot and | |
49 'NexusPlayer' not in bot): | |
50 if 'Android' in bot: | |
51 # The TegraX1 has a regular OpenGL implementation. We bench that instead | |
52 # of ES. | |
53 if 'TegraX1' in bot: | |
54 config.remove('gpu') | |
55 config.extend(['gl', 'glmsaa4', 'glnvpr4', 'glnvprdit4']) | |
56 else: | |
57 config.extend(['msaa4', 'nvpr4', 'nvprdit4']) | |
58 else: | |
59 config.extend(['msaa16', 'nvpr16', 'nvprdit16']) | |
60 | |
61 # Bench instanced rendering on a limited number of platforms | |
62 if 'Nexus6' in bot: | |
63 config.append('esinst') # esinst4 isn't working yet on Adreno. | |
64 elif 'TegraX1' in bot: | |
65 config.extend(['glinst', 'glinst4']) | |
66 elif 'MacMini6.2' in bot: | |
67 config.extend(['glinst', 'glinst16']) | |
68 | |
69 if 'Vulkan' in bot: | |
70 config = ['vk'] | |
71 | |
72 args.append('--config') | |
73 args.extend(config) | |
74 | |
75 if 'Valgrind' in bot: | |
76 # Don't care about Valgrind performance. | |
77 args.extend(['--loops', '1']) | |
78 args.extend(['--samples', '1']) | |
79 # Ensure that the bot framework does not think we have timed out. | |
80 args.extend(['--keepAlive', 'true']) | |
81 | |
82 if 'HD2000' in bot: | |
83 args.extend(['--GPUbenchTileW', '256']) | |
84 args.extend(['--GPUbenchTileH', '256']) | |
85 | |
86 match = [] | |
87 if 'Android' in bot: | |
88 # Segfaults when run as GPU bench. Very large texture? | |
89 match.append('~blurroundrect') | |
90 match.append('~patch_grid') # skia:2847 | |
91 match.append('~desk_carsvg') | |
92 if 'HD2000' in bot: | |
93 match.extend(['~gradient', '~etc1bitmap']) # skia:2895 | |
94 if 'NexusPlayer' in bot: | |
95 match.append('~desk_unicodetable') | |
96 if 'GalaxyS4' in bot: | |
97 match.append('~GLInstancedArraysBench') # skia:4371 | |
98 if 'Nexus5' in bot: | |
99 match.append('~keymobi_shop_mobileweb_ebay_com.skp') # skia:5178 | |
100 if 'iOS' in bot: | |
101 match.append('~blurroundrect') | |
102 match.append('~patch_grid') # skia:2847 | |
103 match.append('~desk_carsvg') | |
104 match.append('~keymobi') | |
105 match.append('~path_hairline') | |
106 match.append('~GLInstancedArraysBench') # skia:4714 | |
107 | |
108 # the 32-bit GCE bots run out of memory in DM when running these large images | |
109 # so defensively disable them in nanobench, too. | |
110 # FIXME (scroggo): This may have just been due to SkImageDecoder's | |
111 # buildTileIndex leaking memory (https://bug.skia.org/4360). That is | |
112 # disabled by default for nanobench, so we may not need this. | |
113 # FIXME (scroggo): Share image blacklists between dm and nanobench? | |
114 if 'x86' in bot and not 'x86-64' in bot: | |
115 match.append('~interlaced1.png') | |
116 match.append('~interlaced2.png') | |
117 match.append('~interlaced3.png') | |
118 | |
119 # This low-end Android bot crashes about 25% of the time while running the | |
120 # (somewhat intense) shapes benchmarks. | |
121 if 'Perf-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Release' in bot: | |
122 match.append('~shapes_') | |
123 | |
124 # We do not need or want to benchmark the decodes of incomplete images. | |
125 # In fact, in nanobench we assert that the full image decode succeeds. | |
126 match.append('~inc0.gif') | |
127 match.append('~inc1.gif') | |
128 match.append('~incInterlaced.gif') | |
129 match.append('~inc0.jpg') | |
130 match.append('~incGray.jpg') | |
131 match.append('~inc0.wbmp') | |
132 match.append('~inc1.wbmp') | |
133 match.append('~inc0.webp') | |
134 match.append('~inc1.webp') | |
135 match.append('~inc0.ico') | |
136 match.append('~inc1.ico') | |
137 match.append('~inc0.png') | |
138 match.append('~inc1.png') | |
139 match.append('~inc2.png') | |
140 match.append('~inc12.png') | |
141 match.append('~inc13.png') | |
142 match.append('~inc14.png') | |
143 match.append('~inc0.webp') | |
144 match.append('~inc1.webp') | |
145 | |
146 if match: | |
147 args.append('--match') | |
148 args.extend(match) | |
149 | |
150 return args | |
151 cov_end = lineno() # Don't care about code coverage past here. | |
152 | |
153 | |
154 def self_test(): | |
155 args = {} | |
156 cases = [ | |
157 'Perf-Android-GCC-Nexus6-GPU-Adreno420-Arm7-Release', | |
158 'Test-Android-GCC-Nexus6-GPU-Adreno420-Arm7-Debug', | |
159 'Perf-Android-Nexus7-Tegra3-Arm7-Release', | |
160 'Perf-Android-GCC-NexusPlayer-GPU-PowerVR-x86-Release', | |
161 'Perf-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Release', | |
162 'Test-Mac-Clang-MacMini6.2-GPU-HD4000-x86_64-Debug', | |
163 'Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind', | |
164 'Test-Win7-MSVC-ShuttleA-GPU-HD2000-x86-Debug-ANGLE', | |
165 'Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Debug', | |
166 'Test-Android-GCC-GalaxyS4-GPU-SGX544-Arm7-Release', | |
167 'Perf-Android-GCC-NVIDIA_Shield-GPU-TegraX1-Arm64-Release', | |
168 'Perf-Android-GCC-NVIDIA_Shield-GPU-TegraX1-Arm64-Release-Vulkan', | |
169 'Perf-Android-GCC-Nexus5-GPU-Adreno330-Arm7-Release', | |
170 ] | |
171 | |
172 this_file = os.path.basename(__file__) | |
173 try: | |
174 import coverage | |
175 cov = coverage.coverage() | |
176 cov.start() | |
177 for case in cases: | |
178 args[case] = get_args(case) | |
179 cov.stop() | |
180 | |
181 _, _, not_run, _ = cov.analysis(this_file) | |
182 filtered = [line for line in not_run if line > cov_start and line < cov_end] | |
183 if filtered: | |
184 print 'Lines not covered by test cases: ', filtered | |
185 sys.exit(1) | |
186 except ImportError: | |
187 print ("We cannot guarantee that this files tests are comprehensive " + | |
188 "without coverage.py. Please install it when you get a chance.") | |
189 | |
190 golden = this_file.replace('.py', '.json') | |
191 with open(os.path.join(os.path.dirname(__file__), golden), 'w') as f: | |
192 json.dump(args, f, indent=2, sort_keys=True) | |
193 | |
194 | |
195 if __name__ == '__main__': | |
196 if len(sys.argv) == 2 and sys.argv[1] == 'test': | |
197 self_test() | |
198 sys.exit(0) | |
199 | |
200 if len(sys.argv) != 3: | |
201 print usage | |
202 sys.exit(1) | |
203 | |
204 with open(sys.argv[1], 'w') as out: | |
205 json.dump(get_args(sys.argv[2]), out) | |
OLD | NEW |