6"""Parses an skpbench result from a line of output text."""
8from __future__
import print_function
13 FLOAT_REGEX =
'[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?'
14 PATTERN = re.compile(
'^(?P<accum_pad> *)'
15 '(?P<accum>' + FLOAT_REGEX +
')'
17 '(?P<median>' + FLOAT_REGEX +
')'
19 '(?P<max>' + FLOAT_REGEX +
')'
21 '(?P<min>' + FLOAT_REGEX +
')'
23 '(?P<stddev>' + FLOAT_REGEX +
'%)'
26 '(?P<sample_ms_pad> +)'
39 match = cls.
PATTERN.search(text)
40 return cls(match)
if match
else None
50 self.
clock = match.group(
'clock')
53 self.
bench = match.group(
'bench')
59 def format(self, config_suffix=None):
60 if not config_suffix
or config_suffix ==
'':
64 for name
in [
'accum',
'median',
'max',
'min',
'stddev',
65 'samples',
'sample_ms',
'clock',
'metric',
'config']:
68 values.append(config_suffix)
70 values.append(bench_pad[
min(
len(config_suffix),
len(bench_pad) - 1):])
72 return ''.
join(values)
static SkString join(const CommandLineFlags::StringArray &)