Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vidjil
vidjil
Commits
ede7025a
Commit
ede7025a
authored
Mar 18, 2021
by
Mathieu Giraud
Browse files
benchmark-releases.py: some flushes
parent
eb900787
Changes
1
Hide whitespace changes
Inline
Side-by-side
algo/tests/benchmark-releases.py
View file @
ede7025a
...
...
@@ -129,6 +129,8 @@ def go(cmd, log=None, time=False):
else
:
flog
=
sys
.
stdout
print
(
cmd
,
end
=
' '
)
sys
.
stdout
.
flush
()
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
)
...
...
@@ -138,8 +140,13 @@ def go(cmd, log=None, time=False):
if
returncode
:
print
(
'FAILED'
,
end
=
' '
)
if
not
time
:
print
()
sys
.
stdout
.
flush
()
raise
subprocess
.
CalledProcessError
(
returncode
,
cmd
)
elif
not
time
:
print
()
sys
.
stdout
.
flush
()
return
else
:
(
utime
,
stime
,
mem
)
=
[
float
(
i
)
for
i
in
time_file
.
read
().
split
()
]
...
...
@@ -147,6 +154,7 @@ def go(cmd, log=None, time=False):
mem
=
mem
//
1000
os
.
unlink
(
time_file
.
name
)
print
(
color
(
ANSI
.
YELLOW
,
'%5.2fu %5.2fs %6.1fM'
%
(
utime
,
stime
,
mem
)))
sys
.
stdout
.
flush
()
return
(
stime
+
utime
,
mem
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment