Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vidjil
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1,712
Issues
1,712
List
Boards
Labels
Service Desk
Milestones
Merge Requests
87
Merge Requests
87
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vidjil
vidjil
Commits
9d7cdd44
Commit
9d7cdd44
authored
May 05, 2020
by
Mikaël Salson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/benchmark-releases.py: Do not time everything
We cannot use time on some commands such as the ones with cd
parent
d8f440dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
algo/tests/benchmark-releases.py
algo/tests/benchmark-releases.py
+7
-4
No files found.
algo/tests/benchmark-releases.py
View file @
9d7cdd44
...
...
@@ -79,15 +79,16 @@ parser.add_argument('-b', '--benchmark', action='store_true', help='benchmark in
parser
.
add_argument
(
'-r'
,
'--retries'
,
type
=
int
,
default
=
1
,
help
=
'Number of times each benchmark is launched'
)
def
go
(
cmd
,
log
=
None
):
def
go
(
cmd
,
log
=
None
,
time
=
False
):
if
log
:
flog
=
open
(
log
,
'a'
)
flog
.
write
(
'
\n\n
%s
\n
'
%
cmd
)
else
:
flog
=
sys
.
stdout
print
(
cmd
,
end
=
' '
)
time_file
=
NamedTemporaryFile
(
mode
=
'w+'
,
delete
=
False
)
cmd
=
"/usr/bin/time -o {} -f '%U
\t
%S
\t
%M' {}"
.
format
(
time_file
.
name
,
cmd
)
if
time
:
time_file
=
NamedTemporaryFile
(
mode
=
'w+'
,
delete
=
False
)
cmd
=
"/usr/bin/time -o {} -f '%U
\t
%S
\t
%M' {}"
.
format
(
time_file
.
name
,
cmd
)
returncode
=
subprocess
.
call
(
cmd
,
shell
=
True
,
stderr
=
subprocess
.
STDOUT
,
stdout
=
flog
)
if
log
:
flog
.
close
()
...
...
@@ -95,6 +96,8 @@ def go(cmd, log=None):
if
returncode
:
print
(
'FAILED'
,
end
=
' '
)
raise
subprocess
.
CalledProcessError
(
returncode
,
cmd
)
elif
not
time
:
return
else
:
(
utime
,
stime
,
mem
)
=
[
float
(
i
)
for
i
in
time_file
.
read
().
split
()
]
...
...
@@ -174,7 +177,7 @@ def run_all(tag, args, retries):
try
:
benchs
=
[]
for
i
in
range
(
retries
)
:
benchs
.
append
(
go
(
cmd
,
log
))
benchs
.
append
(
go
(
cmd
,
log
,
True
))
time
=
min
([
b
[
0
]
for
b
in
benchs
])
mem
=
min
([
b
[
1
]
for
b
in
benchs
])
stats
[
tag
,
release
]
=
(
time
,
mem
)
...
...
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