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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
691eefbe
Commit
691eefbe
authored
Apr 3, 2017
by
Craig Tiller
Browse files
Options
Downloads
Patches
Plain Diff
Parallel bm_diff
parent
f69317cf
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/profiling/microbenchmarks/bm_diff.py
+16
-17
16 additions, 17 deletions
tools/profiling/microbenchmarks/bm_diff.py
with
16 additions
and
17 deletions
tools/profiling/microbenchmarks/bm_diff.py
+
16
−
17
View file @
691eefbe
#!/usr/bin/env python2.7
args
.
benchmarks
#!/usr/bin/env python2.7
# Copyright 2017, Google Inc.
# Copyright 2017, Google Inc.
# All rights reserved.
# All rights reserved.
#
#
...
@@ -41,6 +41,7 @@ import pipes
...
@@ -41,6 +41,7 @@ import pipes
import
os
import
os
sys
.
path
.
append
(
os
.
path
.
join
(
os
.
path
.
dirname
(
sys
.
argv
[
0
]),
'
..
'
,
'
..
'
,
'
run_tests
'
,
'
python_utils
'
))
sys
.
path
.
append
(
os
.
path
.
join
(
os
.
path
.
dirname
(
sys
.
argv
[
0
]),
'
..
'
,
'
..
'
,
'
run_tests
'
,
'
python_utils
'
))
import
comment_on_pr
import
comment_on_pr
import
jobset
def
changed_ratio
(
n
,
o
):
def
changed_ratio
(
n
,
o
):
if
float
(
o
)
<=
.
0001
:
o
=
0
if
float
(
o
)
<=
.
0001
:
o
=
0
...
@@ -101,8 +102,9 @@ argp.add_argument('-t', '--track',
...
@@ -101,8 +102,9 @@ argp.add_argument('-t', '--track',
help
=
'
Which metrics to track
'
)
help
=
'
Which metrics to track
'
)
argp
.
add_argument
(
'
-b
'
,
'
--benchmarks
'
,
nargs
=
'
+
'
,
choices
=
_AVAILABLE_BENCHMARK_TESTS
,
default
=
[
'
bm_cq
'
])
argp
.
add_argument
(
'
-b
'
,
'
--benchmarks
'
,
nargs
=
'
+
'
,
choices
=
_AVAILABLE_BENCHMARK_TESTS
,
default
=
[
'
bm_cq
'
])
argp
.
add_argument
(
'
-d
'
,
'
--diff_base
'
,
type
=
str
)
argp
.
add_argument
(
'
-d
'
,
'
--diff_base
'
,
type
=
str
)
argp
.
add_argument
(
'
-r
'
,
'
--repetitions
'
,
type
=
int
,
default
=
7
)
argp
.
add_argument
(
'
-r
'
,
'
--repetitions
'
,
type
=
int
,
default
=
30
)
argp
.
add_argument
(
'
-p
'
,
'
--p_threshold
'
,
type
=
float
,
default
=
0.01
)
argp
.
add_argument
(
'
-p
'
,
'
--p_threshold
'
,
type
=
float
,
default
=
0.01
)
argp
.
add_argument
(
'
-j
'
,
'
--jobs
'
,
type
=
int
,
default
=
multiprocessing
.
cpu_count
())
args
=
argp
.
parse_args
()
args
=
argp
.
parse_args
()
assert
args
.
diff_base
assert
args
.
diff_base
...
@@ -117,7 +119,7 @@ def avg(lst):
...
@@ -117,7 +119,7 @@ def avg(lst):
def
make_cmd
(
cfg
):
def
make_cmd
(
cfg
):
return
[
'
make
'
]
+
args
.
benchmarks
+
[
return
[
'
make
'
]
+
args
.
benchmarks
+
[
'
CONFIG=%s
'
%
cfg
,
'
-j
'
,
'
%d
'
%
multiprocessing
.
cpu_count
()
]
'
CONFIG=%s
'
%
cfg
,
'
-j
'
,
'
%d
'
%
args
.
jobs
]
def
build
():
def
build
():
subprocess
.
check_call
([
'
git
'
,
'
submodule
'
,
'
update
'
])
subprocess
.
check_call
([
'
git
'
,
'
submodule
'
,
'
update
'
])
...
@@ -135,27 +137,24 @@ def collect1(bm, cfg, ver):
...
@@ -135,27 +137,24 @@ def collect1(bm, cfg, ver):
'
--benchmark_out_format=json
'
,
'
--benchmark_out_format=json
'
,
'
--benchmark_repetitions=%d
'
%
(
args
.
repetitions
)
'
--benchmark_repetitions=%d
'
%
(
args
.
repetitions
)
]
]
print
cmd
return
jobset
.
JobSpec
(
cmd
,
shortname
=
'
%s %s %s
'
%
(
bm
,
cfg
,
ver
),
subprocess
.
check_call
(
cmd
)
verbose_success
=
True
)
build
()
build
()
for
bm
in
args
.
benchmarks
:
jobset
.
run
(
itertools
.
chain
(
collect1
(
bm
,
'
opt
'
,
'
new
'
)
(
collect1
(
bm
,
'
opt
'
,
'
new
'
)
for
bm
in
args
.
benchmarks
),
collect1
(
bm
,
'
counters
'
,
'
new
'
)
(
collect1
(
bm
,
'
counters
'
,
'
new
'
)
for
bm
in
args
.
benchmarks
),
),
maxjobs
=
args
.
jobs
)
where_am_i
=
subprocess
.
check_output
([
'
git
'
,
'
rev-parse
'
,
'
--abbrev-ref
'
,
'
HEAD
'
]).
strip
()
where_am_i
=
subprocess
.
check_output
([
'
git
'
,
'
rev-parse
'
,
'
--abbrev-ref
'
,
'
HEAD
'
]).
strip
()
subprocess
.
check_call
([
'
git
'
,
'
checkout
'
,
args
.
diff_base
])
subprocess
.
check_call
([
'
git
'
,
'
checkout
'
,
args
.
diff_base
])
try
:
try
:
build
()
build
()
comparables
=
[]
jobset
.
run
(
itertools
.
chain
(
for
bm
in
args
.
benchmarks
:
(
collect1
(
bm
,
'
opt
'
,
'
new
'
)
for
bm
in
args
.
benchmarks
),
try
:
(
collect1
(
bm
,
'
counters
'
,
'
new
'
)
for
bm
in
args
.
benchmarks
),
collect1
(
bm
,
'
opt
'
,
'
old
'
)
),
maxjobs
=
args
.
jobs
)
collect1
(
bm
,
'
counters
'
,
'
old
'
)
comparables
.
append
(
bm
)
except
subprocess
.
CalledProcessError
,
e
:
pass
finally
:
finally
:
subprocess
.
check_call
([
'
git
'
,
'
checkout
'
,
where_am_i
])
subprocess
.
check_call
([
'
git
'
,
'
checkout
'
,
where_am_i
])
subprocess
.
check_call
([
'
git
'
,
'
submodule
'
,
'
update
'
])
subprocess
.
check_call
([
'
git
'
,
'
submodule
'
,
'
update
'
])
...
@@ -201,7 +200,7 @@ class Benchmark:
...
@@ -201,7 +200,7 @@ class Benchmark:
benchmarks
=
collections
.
defaultdict
(
Benchmark
)
benchmarks
=
collections
.
defaultdict
(
Benchmark
)
for
bm
in
comparable
s
:
for
bm
in
args
.
benchmark
s
:
with
open
(
'
%s.counters.new.json
'
%
bm
)
as
f
:
with
open
(
'
%s.counters.new.json
'
%
bm
)
as
f
:
js_new_ctr
=
json
.
loads
(
f
.
read
())
js_new_ctr
=
json
.
loads
(
f
.
read
())
with
open
(
'
%s.opt.new.json
'
%
bm
)
as
f
:
with
open
(
'
%s.opt.new.json
'
%
bm
)
as
f
:
...
...
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