Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
tools
skpbench
_benchresult.py
Go to the documentation of this file.
1
# Copyright 2016 Google Inc.
2
#
3
# Use of this source code is governed by a BSD-style license that can be
4
# found in the LICENSE file.
5
6
"""Parses an skpbench result from a line of output text."""
7
8
from
__future__
import
print_function
9
import
re
10
import
sys
11
12
class
BenchResult
:
13
FLOAT_REGEX =
'[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?'
14
PATTERN = re.compile(
'^(?P<accum_pad> *)'
15
'(?P<accum>'
+ FLOAT_REGEX +
')'
16
'(?P<median_pad> +)'
17
'(?P<median>'
+ FLOAT_REGEX +
')'
18
'(?P<max_pad> +)'
19
'(?P<max>'
+ FLOAT_REGEX +
')'
20
'(?P<min_pad> +)'
21
'(?P<min>'
+ FLOAT_REGEX +
')'
22
'(?P<stddev_pad> +)'
23
'(?P<stddev>'
+ FLOAT_REGEX +
'%)'
24
'(?P<samples_pad> +)'
25
'(?P<samples>\d+)'
26
'(?P<sample_ms_pad> +)'
27
'(?P<sample_ms>\d+)'
28
'(?P<clock_pad> +)'
29
'(?P<clock>[cg]pu)'
30
'(?P<metric_pad> +)'
31
'(?P<metric>ms|fps)'
32
'(?P<config_pad> +)'
33
'(?P<config>[^\s]+)'
34
'(?P<bench_pad> +)'
35
'(?P<bench>[^\s]+)$'
)
36
37
@classmethod
38
def
match
(cls, text):
39
match = cls.
PATTERN
.search(text)
40
return
cls(match)
if
match
else
None
41
42
def
__init__
(self, match):
43
self.
accum
= float(match.group(
'accum'
))
44
self.
median
= float(match.group(
'median'
))
45
self.
max
= float(match.group(
'max'
))
46
self.
min
= float(match.group(
'min'
))
47
self.
stddev
= float(match.group(
'stddev'
)[:-1])
# Drop '%' sign.
48
self.
samples
=
int
(match.group(
'samples'
))
49
self.
sample_ms
=
int
(match.group(
'sample_ms'
))
50
self.
clock
= match.group(
'clock'
)
51
self.
metric
= match.group(
'metric'
)
52
self.
config
= match.group(
'config'
)
53
self.
bench
= match.group(
'bench'
)
54
self.
_match
= match
55
56
def
get_string
(self, name):
57
return
self.
_match
.group(name)
58
59
def
format
(self, config_suffix=None):
60
if
not
config_suffix
or
config_suffix ==
''
:
61
return
self.
_match
.group(0)
62
else
:
63
values = list()
64
for
name
in
[
'accum'
,
'median'
,
'max'
,
'min'
,
'stddev'
,
65
'samples'
,
'sample_ms'
,
'clock'
,
'metric'
,
'config'
]:
66
values.append(self.
get_string
(name +
'_pad'
))
67
values.append(self.
get_string
(name))
68
values.append(config_suffix)
69
bench_pad = self.
get_string
(
'bench_pad'
)
70
values.append(bench_pad[
min
(len(config_suffix), len(bench_pad) - 1):])
71
values.append(self.
get_string
(
'bench'
))
72
return
''
.join(values)
int
Type::kYUV Type::kRGBA() int(0.7 *637)
tools.skpbench._benchresult.BenchResult
Definition
_benchresult.py:12
tools.skpbench._benchresult.BenchResult.clock
clock
Definition
_benchresult.py:50
tools.skpbench._benchresult.BenchResult.accum
accum
Definition
_benchresult.py:43
tools.skpbench._benchresult.BenchResult._match
_match
Definition
_benchresult.py:54
tools.skpbench._benchresult.BenchResult.min
min
Definition
_benchresult.py:46
tools.skpbench._benchresult.BenchResult.match
match(cls, text)
Definition
_benchresult.py:38
tools.skpbench._benchresult.BenchResult.samples
samples
Definition
_benchresult.py:48
tools.skpbench._benchresult.BenchResult.__init__
__init__(self, match)
Definition
_benchresult.py:42
tools.skpbench._benchresult.BenchResult.PATTERN
PATTERN
Definition
_benchresult.py:14
tools.skpbench._benchresult.BenchResult.config
config
Definition
_benchresult.py:52
tools.skpbench._benchresult.BenchResult.bench
bench
Definition
_benchresult.py:53
tools.skpbench._benchresult.BenchResult.metric
metric
Definition
_benchresult.py:51
tools.skpbench._benchresult.BenchResult.max
max
Definition
_benchresult.py:45
tools.skpbench._benchresult.BenchResult.sample_ms
sample_ms
Definition
_benchresult.py:49
tools.skpbench._benchresult.BenchResult.get_string
get_string(self, name)
Definition
_benchresult.py:56
tools.skpbench._benchresult.BenchResult.stddev
stddev
Definition
_benchresult.py:47
tools.skpbench._benchresult.BenchResult.median
median
Definition
_benchresult.py:44
format
uint32_t uint32_t * format
Definition
fl_texture_registrar_test.cc:41
Generated on Fri Apr 26 2024 06:18:13 for Flutter Engine by
1.9.8