Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
i4
manycore
syscall-eval
Commits
eda3df80
Commit
eda3df80
authored
Aug 03, 2021
by
Florian Fischer
Browse files
add simple python script to generate boxplots
parent
66319fdc
Pipeline
#66585
failed with stage
in 60 minutes and 1 second
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
gen-boxplots.py
0 → 100755
View file @
eda3df80
#!/usr/bin/env python3
import
yaml
import
sys
def
parse_data
(
stream
):
"""Convert yamls string to dict"""
return
yaml
.
safe_load
(
stream
)
TIKZ_TEMPLATE
=
\
"""
\\
documentclass[crop=false]{standalone}
\\
usepackage{pgfplotstable}
\\
pgfplotsset{compat=1.17}
\\
usepgfplotslibrary{statistics}
\\
begin{document}
\\
begin{tikzpicture}
\\
begin{axis}[
boxplot/draw direction=y,
legend columns=2,
area legend,
legend style={
font=\scriptsize,
draw=none,
fill=none,
at={(0.5,-0.1)},
anchor=north
},
]
$PLOTS$
\\
end{axis}
\\
end{tikzpicture}
\\
end{document}
"""
PLOT_TEMPLATE
=
\
"""
\\
addplot+[
boxplot prepared={{
lower whisker={lower_whisker},
lower quartile={lower_quartile},
median={median},
average={mean},
upper quartile={upper_quartile},
upper whisker={upper_whisker},
}},
] coordinates{{}};
\\
addlegendentry{{{syscall}}}
"""
def
generate_boxplot
(
data
):
plots
=
''
for
syscall
,
stats
in
data
.
items
():
plots
+=
PLOT_TEMPLATE
.
format
(
syscall
=
syscall
.
replace
(
'_'
,
'-'
),
**
stats
[
"nanos"
])
return
TIKZ_TEMPLATE
.
replace
(
'$PLOTS$'
,
plots
)
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
==
1
:
_data
=
parse_data
(
sys
.
stdin
)
else
:
with
open
(
sys
.
argv
[
1
],
'r'
)
as
yaml_file
:
_data
=
parse_data
(
yaml_file
)
tikz
=
generate_boxplot
(
_data
)
if
len
(
sys
.
argv
)
>
2
:
with
open
(
sys
.
argv
[
2
],
'w'
)
as
saveto
:
print
(
tikz
,
file
=
saveto
)
else
:
print
(
tikz
)
stats.c
View file @
eda3df80
...
...
@@ -109,8 +109,8 @@ void print_desc_stats(const char* name, const char* indentation, const uint64_t*
printf
(
"%s%smean: %lu
\n
"
,
indentation
,
indentation
,
mean
);
printf
(
"%s%svar: %lu
\n
"
,
indentation
,
indentation
,
var
);
printf
(
"%s%sstd: %lu
\n
"
,
indentation
,
indentation
,
std
);
printf
(
"%s%s
prctl_25
: %lu
\n
"
,
indentation
,
indentation
,
prctl_25
);
printf
(
"%s%s
prctl_75
: %lu
\n
"
,
indentation
,
indentation
,
prctl_75
);
printf
(
"%s%s
lower_quartile
: %lu
\n
"
,
indentation
,
indentation
,
prctl_25
);
printf
(
"%s%s
upper_quartile
: %lu
\n
"
,
indentation
,
indentation
,
prctl_75
);
printf
(
"%s%slower_whisker: %lu
\n
"
,
indentation
,
indentation
,
lower_whisker
);
printf
(
"%s%supper_whisker: %lu
\n
"
,
indentation
,
indentation
,
upper_whisker
);
}
Write
Preview
Supports
Markdown
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