Skip to content
Snippets Groups Projects
Commit aba782a1 authored by Florian Fischer's avatar Florian Fischer
Browse files

update plots

parent 163994bb
No related branches found
No related tags found
No related merge requests found
Pipeline #80055 failed
#!/usr/bin/env python3 #!/usr/bin/env python3
"""generate boxplots from descriptive stats in yaml""" """generate boxplots from descriptive stats in yaml"""
import os
import sys import sys
import typing as T import typing as T
...@@ -8,6 +9,72 @@ import yaml ...@@ -8,6 +9,72 @@ import yaml
Data = dict[str, T.Any] Data = dict[str, T.Any]
PLOT_SPECIFICS = {
'hints': {
'ylabel': '{latency [us]}',
'ymax': '300',
'xmax': '3',
'xtick': '{1,2}',
'xticklabels': '{pipe, pipe-no-hints}',
'title': 'Wakeup Hints',
},
'latency': {
'ymax': '1500',
'xtick': '{1,2,3}',
'xticklabels': '{pipe-steal-nc, pipe, pipe-nc}',
'title': 'Pipe Latency Variants'
},
'contention': {
'ymax': '1100',
'xtick': '{1,2,3}',
'xticklabels': '{no-sleep, vanilla}',
'title': 'Global queue contention'
},
'l-vs-ll': {
'ymax': '1500',
'xtick': '{1,2,3,4}',
'xticklabels': '{ll-n-nc, n-nc\\vertPhantom{}, ll-s-nc, s-nc\\vertPhantom{}}',
'title': ' Lockless vs Locked'
},
'n-s-c': {
'ylabel': '{latency [us]}',
'ymax': '1300',
'xtick': '{1,2,3,4}',
'xticklabels': '{n, n-nc, s, s-nc}',
'title': 'Additional Completer'
},
'n-vs-ns': {
'ylabel': '{latency [us]}',
'ymax': '150',
'xtick': '{1,2,3}',
'xticklabels': '{ll-n-nc, s-ns, ll-s-ns}',
'title': 'Notifications vs No Sleep'
},
'strategies': {
'ymax': '250',
'xtick': '{1,2,3}',
'xticklabels': '{vanilla, pipe, \\waitfd{}}',
'title': 'Sleep Strategies'
},
}
def generate_plot_specifics() -> str:
"""Generate plot specifics for the plot passed via the environment"""
plot = os.environ['BOXPLOT']
if not plot:
return ''
if plot not in PLOT_SPECIFICS:
print(f'ERROR: specified plot "{plot}" unknown', file=sys.stderr)
sys.exit(1)
tikz_lines = []
for key, value in PLOT_SPECIFICS[plot].items():
tikz_lines.append(f'{key}={value}')
return ',\n'.join(tikz_lines)
def parse_data(stream) -> T.Optional[Data]: def parse_data(stream) -> T.Optional[Data]:
"""Convert yamls string to dict""" """Convert yamls string to dict"""
...@@ -15,22 +82,27 @@ def parse_data(stream) -> T.Optional[Data]: ...@@ -15,22 +82,27 @@ def parse_data(stream) -> T.Optional[Data]:
TIKZ_TEMPLATE = \ TIKZ_TEMPLATE = \
"""\\documentclass[]{standalone} """\\documentclass[]{standalone}
\\usepackage{pgfplots} \\input{common.tex}
\\pgfplotsset{compat=1.17}
\\usepgfplotslibrary{statistics}
\\begin{document} \\begin{document}
\\begin{tikzpicture} \\begin{tikzpicture}
\\begin{axis}[ \\begin{axis}[
mark=x,
boxplot/draw direction=y, boxplot/draw direction=y,
legend columns=2, legend columns=2,
area legend, area legend,
ylabel="latency [us]", xmin=0,
xtick pos=bottom,
ytick pos=left,
xminorticks=false,
yminorticks=false,
ymajorgrids=true,
legend style={ legend style={
draw=none, draw=none,
fill=none, fill=none,
at={(0.5,-0.1)}, at={(0.5,-0.1)},
anchor=north anchor=north
}, },
$PLOT_SPECIFICS$
] ]
$PLOTS$ $PLOTS$
\\end{axis} \\end{axis}
...@@ -40,6 +112,7 @@ $PLOTS$ ...@@ -40,6 +112,7 @@ $PLOTS$
PLOT_TEMPLATE = \ PLOT_TEMPLATE = \
"""\\addplot+[ """\\addplot+[
mark=x,
boxplot prepared={{ boxplot prepared={{
lower whisker={lower_whisker}, lower whisker={lower_whisker},
lower quartile={lower_quartile}, lower quartile={lower_quartile},
...@@ -49,13 +122,15 @@ PLOT_TEMPLATE = \ ...@@ -49,13 +122,15 @@ PLOT_TEMPLATE = \
upper whisker={upper_whisker}, upper whisker={upper_whisker},
}}, }},
] coordinates{{{outlier_cords}}}; ] coordinates{{{outlier_cords}}};
\\addlegendentry{{{variant}}} %\\addlegendentry{{{variant}}}
""" """
def generate_boxplot(data: Data) -> str: def generate_boxplot(data: Data) -> str:
"""generate a tikzboxplot""" """generate a tikzboxplot"""
plots = '' plots = ''
for variant, stats in data.items(): for variant, stats in data.items():
outlier_cords = '' outlier_cords = ''
for outlier in stats['outliers']: for outlier in stats['outliers']:
...@@ -64,7 +139,11 @@ def generate_boxplot(data: Data) -> str: ...@@ -64,7 +139,11 @@ def generate_boxplot(data: Data) -> str:
outlier_cords=outlier_cords, outlier_cords=outlier_cords,
**stats) **stats)
return TIKZ_TEMPLATE.replace('$PLOTS$', plots) tikz = TIKZ_TEMPLATE.replace('$PLOTS$', plots)
plot_specifics = generate_plot_specifics()
tikz = tikz.replace('$PLOT_SPECIFICS$', plot_specifics)
return tikz
def main(): def main():
......
...@@ -6,6 +6,7 @@ SUM=./summarize.py ...@@ -6,6 +6,7 @@ SUM=./summarize.py
PLOT=./gen_boxplots.py PLOT=./gen_boxplots.py
PLOT_DIR=plots/ PLOT_DIR=plots/
PLOT_PREFIX=iol
RESULTS=$1 RESULTS=$1
shift shift
...@@ -15,20 +16,28 @@ if [[ -z "${RESULTS}" ]]; then ...@@ -15,20 +16,28 @@ if [[ -z "${RESULTS}" ]]; then
exit 1 exit 1
fi fi
${SUM} --yaml -i emper-pipe emper-pipe-no-hint -- "${RESULTS}" | ${PLOT} > ${PLOT_DIR}/io-latency-hints.tex ${SUM} --yaml -i emper-pipe emper-pipe-no-hint -- "${RESULTS}" \
| BOXPLOT="hints" ${PLOT} > ${PLOT_DIR}/${PLOT_PREFIX}-hints.tex
${SUM} --yaml -i emper-pipe emper-pipe-no-comp emper-io-stealing-pipe-no-comp -- "${RESULTS}" \ ${SUM} --yaml -i emper-pipe emper-pipe-no-comp emper-io-stealing-pipe-no-comp -- "${RESULTS}" \
| ${PLOT} > ${PLOT_DIR}/io-latency.tex | BOXPLOT="latency" ${PLOT} > ${PLOT_DIR}/${PLOT_PREFIX}-latency.tex
${SUM} --yaml -i emper-pipe emper-waitfd -- "${RESULTS}" | ${PLOT} > ${PLOT_DIR}/pipe-vs-waitfd.tex ${SUM} --yaml -i emper-vanilla emper-no-sleep -- "${RESULTS}" \
| BOXPLOT="contention" ${PLOT} > ${PLOT_DIR}/${PLOT_PREFIX}-contention.tex
${SUM} --yaml -i emper-vanilla emper-pipe emper-waitfd -- "${RESULTS}" \
| BOXPLOT="strategies" ${PLOT} > ${PLOT_DIR}/${PLOT_PREFIX}-strategies.tex
${SUM} --yaml -i emper-io-notification-waitfd-no-comp emper-io-notification-waitfd \ ${SUM} --yaml -i emper-io-notification-waitfd-no-comp emper-io-notification-waitfd \
emper-io-stealing-waitfd-no-comp emper-io-stealing-waitfd -- "${RESULTS}" \ emper-io-stealing-waitfd-no-comp emper-io-stealing-waitfd -- "${RESULTS}" \
| ${PLOT} > ${PLOT_DIR}/notification-stealing-completer.tex | BOXPLOT="n-s-c" ${PLOT} > ${PLOT_DIR}/${PLOT_PREFIX}-notification-stealing-completer.tex
${SUM} --yaml -i emper-io-notification-lockless-waitfd-no-comp emper-io-notification-waitfd-no-comp \ ${SUM} --yaml -i emper-io-notification-lockless-waitfd-no-comp emper-io-notification-waitfd-no-comp \
emper-io-stealing-lockless-waitfd-no-comp emper-io-stealing-waitfd-no-comp -- "${RESULTS}" \ emper-io-stealing-lockless-waitfd-no-comp emper-io-stealing-waitfd-no-comp -- "${RESULTS}" \
| ${PLOT} > ${PLOT_DIR}/lockless-vs-locked.tex | BOXPLOT="l-vs-ll" ${PLOT} > ${PLOT_DIR}/${PLOT_PREFIX}-lockless-vs-locked.tex
${SUM} --yaml -i emper-io-notification-lockless-waitfd-no-comp \
emper-stealing-no-sleep emper-stealing-lockless-no-sleep -- "${RESULTS}" \
| BOXPLOT="n-vs-ns" ${PLOT} > ${PLOT_DIR}/${PLOT_PREFIX}-notification-vs-nosleep.tex
${SUM} --yaml -i emper-io-notification-lockless-waitfd-no-comp emper-no-sleep -- "${RESULTS}" \
| ${PLOT} > ${PLOT_DIR}/notification-vs-nosleep.tex
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usepgfplotslibrary{statistics}
\NewDocumentCommand \Waitfd{}{\texttt{Suspendfd}}
\NewDocumentCommand \waitfd{}{\texttt{suspendfd}}
\NewDocumentCommand \vertPhantom {}{\vphantom{gG}}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment