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
25e3c6da
Commit
25e3c6da
authored
8 years ago
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Fix EINTR forever
parent
c2d9f1e2
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
+49
-42
49 additions, 42 deletions
tools/profiling/microbenchmarks/bm_diff.py
with
49 additions
and
42 deletions
tools/profiling/microbenchmarks/bm_diff.py
+
49
−
42
View file @
25e3c6da
...
@@ -192,52 +192,59 @@ class Benchmark:
...
@@ -192,52 +192,59 @@ class Benchmark:
return
[
self
.
final
[
f
]
if
f
in
self
.
final
else
''
for
f
in
flds
]
return
[
self
.
final
[
f
]
if
f
in
self
.
final
else
''
for
f
in
flds
]
def
read_file
(
filename
):
def
eintr_be_gone
(
fn
):
"""
Run fn until it doesn
'
t stop because of EINTR
"""
while
True
:
while
True
:
try
:
try
:
with
open
(
filename
)
as
f
:
return
fn
()
return
f
.
read
()
except
IOError
,
e
:
except
IOError
,
e
:
if
e
.
errno
!=
errno
.
EINTR
:
if
e
.
errno
!=
errno
.
EINTR
:
raise
raise
def
read_json
(
filename
):
def
read_json
(
filename
):
return
json
.
loads
(
read_file
(
filename
))
with
open
(
filename
)
as
f
:
return
json
.
loads
(
f
.
read
())
benchmarks
=
collections
.
defaultdict
(
Benchmark
)
def
finalize
():
for
bm
in
args
.
benchmarks
:
benchmarks
=
collections
.
defaultdict
(
Benchmark
)
for
loop
in
range
(
0
,
args
.
loops
):
js_new_ctr
=
read_json
(
'
%s.counters.new.%d.json
'
%
(
bm
,
loop
))
for
bm
in
args
.
benchmarks
:
js_new_opt
=
read_json
(
'
%s.opt.new.%d.json
'
%
(
bm
,
loop
))
for
loop
in
range
(
0
,
args
.
loops
):
js_old_ctr
=
read_json
(
'
%s.counters.old.%d.json
'
%
(
bm
,
loop
))
js_new_ctr
=
read_json
(
'
%s.counters.new.%d.json
'
%
(
bm
,
loop
))
js_old_opt
=
read_json
(
'
%s.opt.old.%d.json
'
%
(
bm
,
loop
))
js_new_opt
=
read_json
(
'
%s.opt.new.%d.json
'
%
(
bm
,
loop
))
js_old_ctr
=
read_json
(
'
%s.counters.old.%d.json
'
%
(
bm
,
loop
))
for
row
in
bm_json
.
expand_json
(
js_new_ctr
,
js_new_opt
):
js_old_opt
=
read_json
(
'
%s.opt.old.%d.json
'
%
(
bm
,
loop
))
print
row
name
=
row
[
'
cpp_name
'
]
for
row
in
bm_json
.
expand_json
(
js_new_ctr
,
js_new_opt
):
if
name
.
endswith
(
'
_mean
'
)
or
name
.
endswith
(
'
_stddev
'
):
continue
print
row
benchmarks
[
name
].
add_sample
(
row
,
True
)
name
=
row
[
'
cpp_name
'
]
for
row
in
bm_json
.
expand_json
(
js_old_ctr
,
js_old_opt
):
if
name
.
endswith
(
'
_mean
'
)
or
name
.
endswith
(
'
_stddev
'
):
continue
print
row
benchmarks
[
name
].
add_sample
(
row
,
True
)
name
=
row
[
'
cpp_name
'
]
for
row
in
bm_json
.
expand_json
(
js_old_ctr
,
js_old_opt
):
if
name
.
endswith
(
'
_mean
'
)
or
name
.
endswith
(
'
_stddev
'
):
continue
print
row
benchmarks
[
name
].
add_sample
(
row
,
False
)
name
=
row
[
'
cpp_name
'
]
if
name
.
endswith
(
'
_mean
'
)
or
name
.
endswith
(
'
_stddev
'
):
continue
really_interesting
=
set
()
benchmarks
[
name
].
add_sample
(
row
,
False
)
for
name
,
bm
in
benchmarks
.
items
():
print
name
really_interesting
=
set
()
really_interesting
.
update
(
bm
.
process
())
for
name
,
bm
in
benchmarks
.
items
():
fields
=
[
f
for
f
in
args
.
track
if
f
in
really_interesting
]
print
name
really_interesting
.
update
(
bm
.
process
())
headers
=
[
'
Benchmark
'
]
+
fields
fields
=
[
f
for
f
in
args
.
track
if
f
in
really_interesting
]
rows
=
[]
for
name
in
sorted
(
benchmarks
.
keys
()):
headers
=
[
'
Benchmark
'
]
+
fields
if
benchmarks
[
name
].
skip
():
continue
rows
=
[]
rows
.
append
([
name
]
+
benchmarks
[
name
].
row
(
fields
))
for
name
in
sorted
(
benchmarks
.
keys
()):
if
rows
:
if
benchmarks
[
name
].
skip
():
continue
text
=
'
Performance differences noted:
\n
'
+
tabulate
.
tabulate
(
rows
,
headers
=
headers
,
floatfmt
=
'
+.2f
'
)
rows
.
append
([
name
]
+
benchmarks
[
name
].
row
(
fields
))
else
:
if
rows
:
text
=
'
No significant performance differences
'
text
=
'
Performance differences noted:
\n
'
+
tabulate
.
tabulate
(
rows
,
headers
=
headers
,
floatfmt
=
'
+.2f
'
)
comment_on_pr
.
comment_on_pr
(
'
```
\n
%s
\n
```
'
%
text
)
else
:
print
text
text
=
'
No significant performance differences
'
comment_on_pr
.
comment_on_pr
(
'
```
\n
%s
\n
```
'
%
text
)
print
text
eintr_be_gone
(
finalize
)
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