Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
benchmark
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
benchmark
Commits
f62c63b1
Unverified
Commit
f62c63b1
authored
Mar 06, 2019
by
Roman Lebedev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Tooling] report.py: don't crash on BigO/RMS benchmarks
Run into this by accident while writing benchmark to validate the fix for
https://bugs.llvm.org/show_bug.cgi?id=40965
Fixes #779.
parent
d205ead2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
2 deletions
+47
-2
test1_run1.json
tools/gbench/Inputs/test1_run1.json
+17
-0
test1_run2.json
tools/gbench/Inputs/test1_run2.json
+17
-0
report.py
tools/gbench/report.py
+13
-2
No files found.
tools/gbench/Inputs/test1_run1.json
View file @
f62c63b1
...
@@ -97,6 +97,23 @@
...
@@ -97,6 +97,23 @@
"real_time"
:
1
,
"real_time"
:
1
,
"cpu_time"
:
1
,
"cpu_time"
:
1
,
"time_unit"
:
"s"
"time_unit"
:
"s"
},
{
"name"
:
"MyComplexityTest_BigO"
,
"run_name"
:
"MyComplexityTest"
,
"run_type"
:
"aggregate"
,
"aggregate_name"
:
"BigO"
,
"cpu_coefficient"
:
4.2749856294592886e+00
,
"real_coefficient"
:
6.4789275289789780e+00
,
"big_o"
:
"N"
,
"time_unit"
:
"ns"
},
{
"name"
:
"MyComplexityTest_RMS"
,
"run_name"
:
"MyComplexityTest"
,
"run_type"
:
"aggregate"
,
"aggregate_name"
:
"RMS"
,
"rms"
:
4.5097802512472874e-03
}
}
]
]
}
}
tools/gbench/Inputs/test1_run2.json
View file @
f62c63b1
...
@@ -97,6 +97,23 @@
...
@@ -97,6 +97,23 @@
"real_time"
:
1
,
"real_time"
:
1
,
"cpu_time"
:
1
,
"cpu_time"
:
1
,
"time_unit"
:
"ns"
"time_unit"
:
"ns"
},
{
"name"
:
"MyComplexityTest_BigO"
,
"run_name"
:
"MyComplexityTest"
,
"run_type"
:
"aggregate"
,
"aggregate_name"
:
"BigO"
,
"cpu_coefficient"
:
5.6215779594361486e+00
,
"real_coefficient"
:
5.6288314793554610e+00
,
"big_o"
:
"N"
,
"time_unit"
:
"ns"
},
{
"name"
:
"MyComplexityTest_RMS"
,
"run_name"
:
"MyComplexityTest"
,
"run_type"
:
"aggregate"
,
"aggregate_name"
:
"RMS"
,
"rms"
:
3.3128901852342174e-03
}
}
]
]
}
}
tools/gbench/report.py
View file @
f62c63b1
...
@@ -114,6 +114,10 @@ def intersect(list1, list2):
...
@@ -114,6 +114,10 @@ def intersect(list1, list2):
return
[
x
for
x
in
list1
if
x
in
list2
]
return
[
x
for
x
in
list1
if
x
in
list2
]
def
is_potentially_comparable_benchmark
(
x
):
return
(
'time_unit'
in
x
and
'real_time'
in
x
and
'cpu_time'
in
x
)
def
partition_benchmarks
(
json1
,
json2
):
def
partition_benchmarks
(
json1
,
json2
):
"""
"""
While preserving the ordering, find benchmarks with the same names in
While preserving the ordering, find benchmarks with the same names in
...
@@ -125,10 +129,17 @@ def partition_benchmarks(json1, json2):
...
@@ -125,10 +129,17 @@ def partition_benchmarks(json1, json2):
names
=
intersect
(
json1_unique_names
,
json2_unique_names
)
names
=
intersect
(
json1_unique_names
,
json2_unique_names
)
partitions
=
[]
partitions
=
[]
for
name
in
names
:
for
name
in
names
:
time_unit
=
None
# Pick the time unit from the first entry of the lhs benchmark.
# Pick the time unit from the first entry of the lhs benchmark.
time_unit
=
(
x
[
'time_unit'
]
# We should be careful not to crash with unexpected input.
for
x
in
json1
[
'benchmarks'
]
if
x
[
'name'
]
==
name
)
.
next
()
for
x
in
json1
[
'benchmarks'
]:
if
(
x
[
'name'
]
==
name
and
is_potentially_comparable_benchmark
(
x
)):
time_unit
=
x
[
'time_unit'
]
break
if
time_unit
is
None
:
break
# Filter by name and time unit.
# Filter by name and time unit.
# All the repetitions are assumed to be comparable.
lhs
=
[
x
for
x
in
json1
[
'benchmarks'
]
if
x
[
'name'
]
==
name
and
lhs
=
[
x
for
x
in
json1
[
'benchmarks'
]
if
x
[
'name'
]
==
name
and
x
[
'time_unit'
]
==
time_unit
]
x
[
'time_unit'
]
==
time_unit
]
rhs
=
[
x
for
x
in
json2
[
'benchmarks'
]
if
x
[
'name'
]
==
name
and
rhs
=
[
x
for
x
in
json2
[
'benchmarks'
]
if
x
[
'name'
]
==
name
and
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment