aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2019-01-15 16:08:44 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2019-01-15 18:29:39 +0100
commit3a5d4ecc1a5aa8b111caae8703d94aac244ffc6b (patch)
tree6e809f508ee23fbf3261ddefa2541c39972c1575
parent259fd2a64bf114907017fe286702218cdf13c8ca (diff)
downloadallocbench-3a5d4ecc1a5aa8b111caae8703d94aac244ffc6b.tar.gz
allocbench-3a5d4ecc1a5aa8b111caae8703d94aac244ffc6b.zip
move benchmark to src dir and add autoticks option to plot functions
-rw-r--r--src/benchmark.py (renamed from benchmark.py)22
1 files changed, 15 insertions, 7 deletions
diff --git a/benchmark.py b/src/benchmark.py
index 1470c4f..f6e7d70 100644
--- a/benchmark.py
+++ b/src/benchmark.py
@@ -9,7 +9,7 @@ import pickle
import shutil
import subprocess
-from common_targets import common_targets
+from src.common_targets import common_targets
class Benchmark (object):
@@ -252,7 +252,7 @@ class Benchmark (object):
print()
return True
- def plot_single_arg(self, yval, ylabel="'y-label'", xlabel="'x-label'",
+ def plot_single_arg(self, yval, ylabel="'y-label'", xlabel="'x-label'", autoticks=True,
title="default title", filepostfix="", sumdir="", arg=""):
args = self.results["args"]
@@ -267,19 +267,23 @@ class Benchmark (object):
for m in self.results[target][perm]:
d.append(eval(yval.format(**m)))
y_vals.append(np.mean(d))
- x_vals = list(range(1, len(y_vals) + 1))
+ if not autoticks:
+ x_vals = list(range(1, len(y_vals) + 1))
+ else:
+ x_vals = args[arg]
plt.plot(x_vals, y_vals, marker='.', linestyle='-',
label=target, color=targets[target]["color"])
plt.legend()
- plt.xticks(x_vals, args[arg])
+ if not autoticks:
+ plt.xticks(x_vals, args[arg])
plt.xlabel(eval(xlabel))
plt.ylabel(eval(ylabel))
plt.title(eval(title))
plt.savefig(os.path.join(sumdir, ".".join([self.name, filepostfix, "png"])))
plt.clf()
- def plot_fixed_arg(self, yval, ylabel="'y-label'", xlabel="loose_arg",
+ def plot_fixed_arg(self, yval, ylabel="'y-label'", xlabel="loose_arg", autoticks=True,
title="'default title'", filepostfix="", sumdir="", fixed=[]):
args = self.results["args"]
@@ -295,12 +299,16 @@ class Benchmark (object):
for m in self.results[target][perm]:
d.append(eval(yval.format(**m)))
y_vals.append(np.mean(d))
- x_vals = list(range(1, len(y_vals) + 1))
+ if not autoticks:
+ x_vals = list(range(1, len(y_vals) + 1))
+ else:
+ x_vals = args[loose_arg]
plt.plot(x_vals, y_vals, marker='.', linestyle='-',
label=target, color=targets[target]["color"])
plt.legend()
- plt.xticks(x_vals, args[loose_arg])
+ if not autoticks:
+ plt.xticks(x_vals, args[loose_arg])
plt.xlabel(eval(xlabel))
plt.ylabel(eval(ylabel))
plt.title(eval(title))