OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright 2016 Google Inc. | 3 # Copyright 2016 Google Inc. |
4 # | 4 # |
5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
7 | 7 |
8 from __future__ import print_function | 8 from __future__ import print_function |
9 from _adb import Adb | 9 from _adb import Adb |
10 from _benchresult import BenchResult | 10 from _benchresult import BenchResult |
(...skipping 26 matching lines...) Expand all Loading... |
37 help="directory to execute ./skpbench from") | 37 help="directory to execute ./skpbench from") |
38 __argparse.add_argument('-m', '--max-stddev', | 38 __argparse.add_argument('-m', '--max-stddev', |
39 type=float, default=4, | 39 type=float, default=4, |
40 help="initial max allowable relative standard deviation") | 40 help="initial max allowable relative standard deviation") |
41 __argparse.add_argument('-x', '--suffix', | 41 __argparse.add_argument('-x', '--suffix', |
42 help="suffix to append on config (e.g. '_before', '_after')") | 42 help="suffix to append on config (e.g. '_before', '_after')") |
43 __argparse.add_argument('-w','--write-path', | 43 __argparse.add_argument('-w','--write-path', |
44 help="directory to save .png proofs to disk.") | 44 help="directory to save .png proofs to disk.") |
45 __argparse.add_argument('-v','--verbosity', | 45 __argparse.add_argument('-v','--verbosity', |
46 type=int, default=1, help="level of verbosity (0=none to 5=debug)") | 46 type=int, default=1, help="level of verbosity (0=none to 5=debug)") |
47 __argparse.add_argument('-n', '--samples', | 47 __argparse.add_argument('-d', '--duration', |
48 type=int, help="number of samples to collect for each bench") | 48 type=int, help="number of milliseconds to run each benchmark") |
49 __argparse.add_argument('-d', '--sample-ms', | 49 __argparse.add_argument('-l', '--sample-ms', |
50 type=int, help="duration of each sample") | 50 type=int, help="minimum duration of a sample") |
51 __argparse.add_argument('--fps', | 51 __argparse.add_argument('--fps', |
52 action='store_true', help="use fps instead of ms") | 52 action='store_true', help="use fps instead of ms") |
53 __argparse.add_argument('-c', '--config', | 53 __argparse.add_argument('-c', '--config', |
54 default='gpu', help="comma- or space-separated list of GPU configs") | 54 default='gpu', help="comma- or space-separated list of GPU configs") |
55 __argparse.add_argument('skps', | 55 __argparse.add_argument('skps', |
56 nargs='+', | 56 nargs='+', |
57 help=".skp files or directories to expand for .skp files") | 57 help=".skp files or directories to expand for .skp files") |
58 | 58 |
59 FLAGS = __argparse.parse_args() | 59 FLAGS = __argparse.parse_args() |
60 if FLAGS.adb: | 60 if FLAGS.adb: |
(...skipping 21 matching lines...) Expand all Loading... |
82 Thread.__init__(self) | 82 Thread.__init__(self) |
83 | 83 |
84 def run(self): | 84 def run(self): |
85 """Runs on the background thread.""" | 85 """Runs on the background thread.""" |
86 for line in iter(self._proc.stdout.readline, b''): | 86 for line in iter(self._proc.stdout.readline, b''): |
87 self._queue.put(Message(Message.READLINE, line.decode('utf-8').rstrip())) | 87 self._queue.put(Message(Message.READLINE, line.decode('utf-8').rstrip())) |
88 self._queue.put(Message(Message.EXIT)) | 88 self._queue.put(Message(Message.EXIT)) |
89 | 89 |
90 class SKPBench: | 90 class SKPBench: |
91 ARGV = ['skpbench', '--verbosity', str(FLAGS.verbosity)] | 91 ARGV = ['skpbench', '--verbosity', str(FLAGS.verbosity)] |
92 if FLAGS.samples: | 92 if FLAGS.duration: |
93 ARGV.extend(['--samples', str(FLAGS.samples)]) | 93 ARGV.extend(['--duration', str(FLAGS.duration)]) |
94 if FLAGS.sample_ms: | 94 if FLAGS.sample_ms: |
95 ARGV.extend(['--sampleMs', str(FLAGS.sample_ms)]) | 95 ARGV.extend(['--sampleMs', str(FLAGS.sample_ms)]) |
96 if FLAGS.fps: | 96 if FLAGS.fps: |
97 ARGV.extend(['--fps', 'true']) | 97 ARGV.extend(['--fps', 'true']) |
98 if FLAGS.path: | 98 if FLAGS.path: |
99 ARGV[0] = _path.join(FLAGS.path, ARGV[0]) | 99 ARGV[0] = _path.join(FLAGS.path, ARGV[0]) |
100 if FLAGS.adb: | 100 if FLAGS.adb: |
101 if FLAGS.device_serial is None: | 101 if FLAGS.device_serial is None: |
102 ARGV = ['adb', 'shell'] + ARGV | 102 ARGV = ['adb', 'shell'] + ARGV |
103 else: | 103 else: |
104 ARGV = ['adb', '-s', FLAGS.device_serial, 'shell'] + ARGV | 104 ARGV = ['adb', '-s', FLAGS.device_serial, 'shell'] + ARGV |
105 | 105 |
106 @classmethod | 106 @classmethod |
107 def print_header(cls): | 107 def print_header(cls): |
108 subprocess.call(cls.ARGV + ['--samples', '0']) | 108 subprocess.call(cls.ARGV + ['--duration', '0']) |
109 | 109 |
110 def __init__(self, skp, config, max_stddev, best_result=None): | 110 def __init__(self, skp, config, max_stddev, best_result=None): |
111 self.skp = skp | 111 self.skp = skp |
112 self.config = config | 112 self.config = config |
113 self.max_stddev = max_stddev | 113 self.max_stddev = max_stddev |
114 self.best_result = best_result | 114 self.best_result = best_result |
115 self._queue = Queue() | 115 self._queue = Queue() |
116 self._proc = None | 116 self._proc = None |
117 self._monitor = None | 117 self._monitor = None |
118 self._hw_poll_timer = None | 118 self._hw_poll_timer = None |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 with hardware: | 257 with hardware: |
258 if hardware.kick_in_time: | 258 if hardware.kick_in_time: |
259 print("sleeping %i seconds to allow hardware settings to kick in..." % | 259 print("sleeping %i seconds to allow hardware settings to kick in..." % |
260 hardware.kick_in_time, file=sys.stderr) | 260 hardware.kick_in_time, file=sys.stderr) |
261 time.sleep(hardware.kick_in_time) | 261 time.sleep(hardware.kick_in_time) |
262 run_benchmarks(configs, skps, hardware) | 262 run_benchmarks(configs, skps, hardware) |
263 | 263 |
264 | 264 |
265 if __name__ == '__main__': | 265 if __name__ == '__main__': |
266 main() | 266 main() |
OLD | NEW |