aboutsummaryrefslogtreecommitdiffstats
path: root/misc/test/plot-bench.py
diff options
context:
space:
mode:
Diffstat (limited to 'misc/test/plot-bench.py')
-rwxr-xr-xmisc/test/plot-bench.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/misc/test/plot-bench.py b/misc/test/plot-bench.py
new file mode 100755
index 0000000..b708fec
--- /dev/null
+++ b/misc/test/plot-bench.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+#
+# Usage: ./plot-bench.py datafile
+# (where datafile is the output of benchmark.sh)
+
+import matplotlib.pyplot as plt
+import sys
+
+def bench_file_to_lists(infile):
+ return [[float(entry) for entry in line.split('\t')[1:]] for line in infile.readlines()]
+
+def plot_data(data):
+ fig = plt.figure()
+ ax = fig.add_axes([0,0,1,1])
+ ax.violinplot(data)
+ plt.savefig("plot.svg")
+
+filename = sys.argv[1]
+
+plot_data(bench_file_to_lists(open(filename)))