OLD | NEW |
1 # Copyright 2016 Google Inc. | 1 # Copyright 2016 Google Inc. |
2 # | 2 # |
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 '''Parses an skpbench result from a line of output text.''' | 6 """Parses an skpbench result from a line of output text.""" |
7 | 7 |
8 from __future__ import print_function | 8 from __future__ import print_function |
9 import re | 9 import re |
10 import sys | 10 import sys |
11 | 11 |
12 class BenchResult: | 12 class BenchResult: |
13 FLOAT_REGEX = '[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?' | 13 FLOAT_REGEX = '[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?' |
14 PATTERN = re.compile('^(?P<median_pad> *)' | 14 PATTERN = re.compile('^(?P<median_pad> *)' |
15 '(?P<median>' + FLOAT_REGEX + ')' | 15 '(?P<median>' + FLOAT_REGEX + ')' |
16 '(?P<accum_pad> +)' | 16 '(?P<accum_pad> +)' |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 values = list() | 60 values = list() |
61 for name in ['median', 'accum', 'max', 'min', 'stddev', | 61 for name in ['median', 'accum', 'max', 'min', 'stddev', |
62 'metric', 'samples', 'sample_ms', 'config']: | 62 'metric', 'samples', 'sample_ms', 'config']: |
63 values.append(self.get_string(name + '_pad')) | 63 values.append(self.get_string(name + '_pad')) |
64 values.append(self.get_string(name)) | 64 values.append(self.get_string(name)) |
65 values.append(config_suffix) | 65 values.append(config_suffix) |
66 bench_pad = self.get_string('bench_pad') | 66 bench_pad = self.get_string('bench_pad') |
67 values.append(bench_pad[min(len(config_suffix), len(bench_pad) - 1):]) | 67 values.append(bench_pad[min(len(config_suffix), len(bench_pad) - 1):]) |
68 values.append(self.get_string('bench')) | 68 values.append(self.get_string('bench')) |
69 print(''.join(values), file=outfile) | 69 print(''.join(values), file=outfile) |
OLD | NEW |