aboutsummaryrefslogtreecommitdiff
path: root/src/benchmark.py
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2019-08-26 18:11:31 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2019-08-26 18:11:31 +0200
commit7561d43ee606bb402d50aad78fcc4ad53274d3cd (patch)
tree280e297abc3e227e7c40f4fe65bcd57f1b9348f3 /src/benchmark.py
parentfdf1371bb0c1aa4432e33f91811068d2786ecda8 (diff)
downloadallocbench-7561d43ee606bb402d50aad78fcc4ad53274d3cd.tar.gz
allocbench-7561d43ee606bb402d50aad78fcc4ad53274d3cd.zip
add error bars to barplot_single_arg
Diffstat (limited to 'src/benchmark.py')
-rw-r--r--src/benchmark.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/benchmark.py b/src/benchmark.py
index dddee69..46177a7 100644
--- a/src/benchmark.py
+++ b/src/benchmark.py
@@ -514,7 +514,7 @@ class Benchmark (object):
def barplot_single_arg(self, yval, ylabel="'y-label'", xlabel="'x-label'",
title="'default title'", filepostfix="", sumdir="",
- arg="", scale=None, file_ext="png"):
+ arg="", scale=None, file_ext="png", yerr=True):
args = self.results["args"]
allocators = self.results["allocators"]
@@ -526,6 +526,10 @@ class Benchmark (object):
for i, allocator in enumerate(allocators):
x_vals = list(range(i, narg * (nallocators+1), nallocators+1))
y_vals = []
+ y_errs = None
+ if yerr:
+ y_errs = []
+
for perm in self.iterate_args(args=args):
if scale:
if scale == allocator:
@@ -537,7 +541,10 @@ class Benchmark (object):
else:
y_vals.append(eval(yval.format(**self.results["stats"][allocator][perm]["mean"])))
- plt.bar(x_vals, y_vals, width=1, label=allocator,
+ if yerr:
+ y_errs.append(eval(yval.format(**self.results["stats"][allocator][perm]["std"])))
+
+ plt.bar(x_vals, y_vals, width=1, label=allocator, yerr=y_errs,
color=allocators[allocator]["color"])
plt.legend(loc="best")