| OLD | NEW | 
|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python | 
| 2 | 2 | 
| 3 usage = ''' | 3 usage = ''' | 
| 4 Write extra flags to outfile for nanobench based on the bot name: | 4 Write extra flags to outfile for nanobench based on the bot name: | 
| 5   $ python nanobench_flags.py outfile Perf-Android-GalaxyS3-Mali400-Arm7-Release | 5   $ python nanobench_flags.py outfile Perf-Android-GalaxyS3-Mali400-Arm7-Release | 
| 6 Or run self-tests: | 6 Or run self-tests: | 
| 7   $ python nanobench_flags.py test | 7   $ python nanobench_flags.py test | 
| 8 ''' | 8 ''' | 
| 9 | 9 | 
| 10 import inspect | 10 import inspect | 
| 11 import json | 11 import json | 
| 12 import os | 12 import os | 
| 13 import sys | 13 import sys | 
| 14 | 14 | 
| 15 | 15 | 
| 16 def lineno(): | 16 def lineno(): | 
| 17   caller = inspect.stack()[1]  # Up one level to our caller. | 17   caller = inspect.stack()[1]  # Up one level to our caller. | 
| 18   return inspect.getframeinfo(caller[0]).lineno | 18   return inspect.getframeinfo(caller[0]).lineno | 
| 19 | 19 | 
| 20 | 20 | 
| 21 cov_start = lineno()+1   # We care about coverage starting just past this def. | 21 cov_start = lineno()+1   # We care about coverage starting just past this def. | 
| 22 def get_args(bot): | 22 def get_args(bot): | 
| 23   args = [] | 23   args = [] | 
| 24 | 24 | 
| 25   args.extend(['--scales', '1.0', '1.1']) | 25   args.extend(['--scales', '1.0', '1.1']) | 
| 26 | 26 | 
|  | 27   config = ['565', '8888', 'gpu', 'nonrendering', 'angle', 'hwui'] | 
|  | 28   # The S4 crashes and the NP produces a long error stream when we run with | 
|  | 29   # MSAA. | 
|  | 30   if ('GalaxyS4'    not in bot and | 
|  | 31       'NexusPlayer' not in bot): | 
|  | 32     if 'Android' in bot: | 
|  | 33       config.extend(['msaa4', 'nvprmsaa4']) | 
|  | 34     else: | 
|  | 35       config.extend(['msaa16', 'nvprmsaa16']) | 
|  | 36   args.append('--config') | 
|  | 37   args.extend(config) | 
|  | 38 | 
| 27   if 'Valgrind' in bot: | 39   if 'Valgrind' in bot: | 
| 28     # Don't care about Valgrind performance. | 40     # Don't care about Valgrind performance. | 
| 29     args.extend(['--loops',   '1']) | 41     args.extend(['--loops',   '1']) | 
| 30     args.extend(['--samples', '1']) | 42     args.extend(['--samples', '1']) | 
| 31 | 43 | 
| 32   match = [] | 44   match = [] | 
| 33   if 'Android' in bot: | 45   if 'Android' in bot: | 
| 34     # Segfaults when run as GPU bench. Very large texture? | 46     # Segfaults when run as GPU bench. Very large texture? | 
| 35     match.append('~blurroundrect') | 47     match.append('~blurroundrect') | 
| 36     match.append('~patch_grid')  # skia:2847 | 48     match.append('~patch_grid')  # skia:2847 | 
| 37     match.append('~desk_carsvg') | 49     match.append('~desk_carsvg') | 
| 38   if 'HD2000' in bot: | 50   if 'HD2000' in bot: | 
| 39     match.extend(['~gradient', '~etc1bitmap'])  # skia:2895 | 51     match.extend(['~gradient', '~etc1bitmap'])  # skia:2895 | 
| 40   if 'Nexus7' in bot: | 52   if 'Nexus7' in bot: | 
| 41     match = ['skp']  # skia:2774 | 53     match = ['skp']  # skia:2774 | 
| 42   if match: | 54   if match: | 
| 43     args.append('--match') | 55     args.append('--match') | 
| 44     args.extend(match) | 56     args.extend(match) | 
|  | 57 | 
| 45 | 58 | 
| 46   if ('GalaxyS3' in bot or | 59   if ('GalaxyS3' in bot or | 
| 47       'GalaxyS4' in bot): | 60       'GalaxyS4' in bot): | 
| 48     args.append('--nocpu') | 61     args.append('--nocpu') | 
| 49   return args | 62   return args | 
| 50 cov_end = lineno()   # Don't care about code coverage past here. | 63 cov_end = lineno()   # Don't care about code coverage past here. | 
| 51 | 64 | 
| 52 | 65 | 
| 53 def self_test(): | 66 def self_test(): | 
| 54   import coverage  # This way the bots don't need coverage.py to be installed. | 67   import coverage  # This way the bots don't need coverage.py to be installed. | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 82   if len(sys.argv) == 2 and sys.argv[1] == 'test': | 95   if len(sys.argv) == 2 and sys.argv[1] == 'test': | 
| 83     self_test() | 96     self_test() | 
| 84     sys.exit(0) | 97     sys.exit(0) | 
| 85 | 98 | 
| 86   if len(sys.argv) != 3: | 99   if len(sys.argv) != 3: | 
| 87     print usage | 100     print usage | 
| 88     sys.exit(1) | 101     sys.exit(1) | 
| 89 | 102 | 
| 90   with open(sys.argv[1], 'w') as out: | 103   with open(sys.argv[1], 'w') as out: | 
| 91     json.dump(get_args(sys.argv[2]), out) | 104     json.dump(get_args(sys.argv[2]), out) | 
| OLD | NEW | 
|---|