Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Poulpe
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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
octobus
Poulpe
Commits
da72f842
Commit
da72f842
authored
2 months ago
by
Raphaël Gomès
Browse files
Options
Downloads
Patches
Plain Diff
simple-command: store information about memory usage
Caveats inline
parent
a48391ea
Branches
topic/default/pull-out-of-order.pdb
No related tags found
1 merge request
!46
simple-command: store information about memory usage
Pipeline
#96655
passed
2 months ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python-libs/poulpe/benchmarks.py
+33
-1
33 additions, 1 deletion
python-libs/poulpe/benchmarks.py
with
33 additions
and
1 deletion
python-libs/poulpe/benchmarks.py
+
33
−
1
View file @
da72f842
import
json
import
os
from
pathlib
import
Path
import
platform
import
resource
import
shutil
import
subprocess
import
sys
...
...
@@ -252,6 +254,11 @@
# TODO record poulpe version in results in case results accidentally
# get bogus for some poulpe version.
# XXX This is only valid once (if you only run a single benchmark),
# and returns the RSS of hyperfine + setup + multiple runs + cleanup
total_rss
=
self
.
get_memory_usage
()
number_of_runs
=
len
(
r
[
"
results
"
][
0
][
"
exit_codes
"
])
# we should store more
res
[
"
time
"
]
=
{}
res
[
"
time
"
][
"
user
"
]
=
r
[
"
results
"
][
0
][
"
user
"
]
...
...
@@ -261,8 +268,13 @@
res
[
"
time
"
][
"
standard-deviation
"
]
=
r
[
"
results
"
][
0
][
"
stddev
"
]
res
[
"
time
"
][
"
min
"
]
=
r
[
"
results
"
][
0
][
"
min
"
]
res
[
"
time
"
][
"
max
"
]
=
r
[
"
results
"
][
0
][
"
max
"
]
res
[
"
memory
"
]
=
{}
res
[
"
memory
"
][
"
avg-rss-bytes
"
]
=
total_rss
//
number_of_runs
res
[
"
meta
"
]
=
{
"
runs
"
:
number_of_runs
,
}
if
runtime_info
is
not
None
:
# XXX is there a better place to store this?
res
[
"
runtime_info
"
]
=
runtime_info
return
res
...
...
@@ -264,8 +276,23 @@
if
runtime_info
is
not
None
:
# XXX is there a better place to store this?
res
[
"
runtime_info
"
]
=
runtime_info
return
res
def
get_memory_usage
(
self
):
try
:
max_rss
=
resource
.
getrusage
(
resource
.
RUSAGE_CHILDREN
).
ru_maxrss
except
resource
.
error
:
# "Exceptional circumstance" as per the docs, still we shouldn't
# waste the results because we failed to find the memory usage
max_rss
=
0
# Linux and *BSD return the value in KibiBytes, Darwin flavors in bytes
if
platform
.
system
()
==
"
Darwin
"
:
max_rss
.
ru_maxrss
else
:
max_rss
=
max_rss
*
1024
return
max_rss
def
_time_command
(
self
,
bin_env_path
,
...
...
@@ -383,7 +410,12 @@
pass
r
=
subprocess
.
run
(
time_cmd
,
cwd
=
cwd
,
env
=
env
,
stdout
=
stdout
,
stderr
=
stderr
time_cmd
,
cwd
=
cwd
,
env
=
env
,
stdout
=
stdout
,
stderr
=
stderr
,
start_new_session
=
True
,
)
if
r
.
returncode
!=
0
:
raise
errors
.
BenchmarkRunFailure
(
...
...
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