Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
47c56a67
Commit
47c56a67
authored
8 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
A better benchmark diff script
parent
5adc93e0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/profiling/microbenchmarks/bm_diff.py
+31
-9
31 additions, 9 deletions
tools/profiling/microbenchmarks/bm_diff.py
with
31 additions
and
9 deletions
tools/profiling/microbenchmarks/bm_diff.py
+
31
−
9
View file @
47c56a67
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
sys
import
sys
import
json
import
json
import
bm_json
import
bm_json
import
tabulate
with
open
(
sys
.
argv
[
1
])
as
f
:
with
open
(
sys
.
argv
[
1
])
as
f
:
js_new_ctr
=
json
.
loads
(
f
.
read
())
js_new_ctr
=
json
.
loads
(
f
.
read
())
...
@@ -21,8 +22,11 @@ for row in bm_json.expand_json(js_new_ctr, js_new_opt):
...
@@ -21,8 +22,11 @@ for row in bm_json.expand_json(js_new_ctr, js_new_opt):
for
row
in
bm_json
.
expand_json
(
js_old_ctr
,
js_old_opt
):
for
row
in
bm_json
.
expand_json
(
js_old_ctr
,
js_old_opt
):
old
[
row
[
'
cpp_name
'
]]
=
row
old
[
row
[
'
cpp_name
'
]]
=
row
def
changed_ratio
(
n
,
o
):
return
float
(
n
-
o
)
/
float
(
o
)
def
min_change
(
pct
):
def
min_change
(
pct
):
return
lambda
n
,
o
:
abs
((
n
-
o
)
/
o
-
1
)
>
pct
/
100
return
lambda
n
,
o
:
abs
(
changed_ratio
(
n
,
o
))
>
pct
/
100
.0
_INTERESTING
=
(
_INTERESTING
=
(
(
'
cpu_time
'
,
min_change
(
10
)),
(
'
cpu_time
'
,
min_change
(
10
)),
...
@@ -34,18 +38,36 @@ _INTERESTING = (
...
@@ -34,18 +38,36 @@ _INTERESTING = (
(
'
atm_add_per_iteration
'
,
min_change
(
5
)),
(
'
atm_add_per_iteration
'
,
min_change
(
5
)),
)
)
changed
=
[]
for
fld
,
chk
in
_INTERESTING
:
for
bm
in
new
.
keys
():
if
bm
not
in
old
:
continue
n
=
new
[
bm
]
o
=
old
[
bm
]
if
fld
not
in
n
or
fld
not
in
o
:
continue
if
chk
(
n
[
fld
],
o
[
fld
]):
changed
.
append
((
fld
,
chk
))
break
headers
=
[
'
Benchmark
'
]
+
[
c
[
0
]
for
c
in
changed
]
+
[
'
Details
'
]
rows
=
[]
for
bm
in
sorted
(
new
.
keys
()):
for
bm
in
sorted
(
new
.
keys
()):
if
bm
not
in
old
:
continue
if
bm
not
in
old
:
continue
hdr
=
False
row
=
[
bm
]
any_changed
=
False
n
=
new
[
bm
]
n
=
new
[
bm
]
o
=
old
[
bm
]
o
=
old
[
bm
]
print
n
details
=
''
print
o
for
fld
,
chk
in
_INTERESTING
:
for
fld
,
chk
in
_INTERESTING
:
if
fld
not
in
n
or
fld
not
in
o
:
continue
if
fld
not
in
n
or
fld
not
in
o
:
continue
if
chk
(
n
[
fld
],
o
[
fld
]):
if
chk
(
n
[
fld
],
o
[
fld
]):
if
not
hdr
:
row
.
append
(
changed_ratio
(
n
[
fld
],
o
[
fld
]))
print
'
%s shows changes:
'
%
bm
if
details
:
details
+=
'
,
'
hdr
=
True
details
+=
'
%s:%r-->%r
'
%
(
fld
,
o
[
fld
],
n
[
fld
])
print
'
%s changed %r --> %r
'
%
(
fld
,
o
[
fld
],
n
[
fld
])
any_changed
=
True
sys
.
exit
(
0
)
else
:
row
.
append
(
''
)
if
any_changed
:
row
.
append
(
details
)
rows
.
append
(
row
)
print
tabulate
.
tabulate
(
rows
,
headers
=
headers
,
floatfmt
=
'
+.2f
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment