aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2018-08-18 14:53:31 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2018-08-18 14:53:31 +0200
commit867e0de8170a1a13696391883947e426520ae134 (patch)
tree17fd4a97d9ea62c81ce1018a971d70f714dce860
parent0e701f823c97e7c68da34ca19f544b47bb066824 (diff)
downloadallocbench-867e0de8170a1a13696391883947e426520ae134.tar.gz
allocbench-867e0de8170a1a13696391883947e426520ae134.zip
make targets into directories and add a color attribute
-rw-r--r--common_targets.py37
-rw-r--r--falsesharing.py8
-rw-r--r--loop.py10
-rw-r--r--mysql.py8
4 files changed, 44 insertions, 19 deletions
diff --git a/common_targets.py b/common_targets.py
index 137f34f..c17ab70 100644
--- a/common_targets.py
+++ b/common_targets.py
@@ -1,8 +1,33 @@
-common_targets = {"klmalloc" : ("", "targets/libklmalloc.so"),
- "libc" : ("", ""), # libc
- "tcmalloc" : ("", "targets/libtcmalloc.so"),
- "jemalloc" : ("", "targets/libjemalloc.so"),
- "hoard" : ("", "targets/libhoard.so")
+common_targets = {"klmalloc" : {
+ "cmd_prefix" : "",
+ "binary_suffix" : "",
+ "LD_PRELOAD" : "targets/libklmalloc.so",
+ "color" : "C0"
+ },
+ "glibc" : {
+ "cmd_prefix" : "",
+ "binary_suffix" : "",
+ "LD_PRELOAD" : "",
+ "color" : "C1"
+ },
+ "tcmalloc" : {
+ "cmd_prefix" : "",
+ "binary_suffix" : "",
+ "LD_PRELOAD" : "targets/libtcmalloc.so",
+ "color" : "C2"
+ },
+ "jemalloc" : {
+ "cmd_prefix" : "",
+ "binary_suffix" : "",
+ "LD_PRELOAD" : "targets/libjemalloc.so",
+ "color" : "C3"
+ },
+ "hoard" : {
+ "cmd_prefix" : "",
+ "binary_suffix" : "",
+ "LD_PRELOAD" : "targets/libhoard.so",
+ "color" : "C4"
+ },
}
-analyse_targets = {"chattymalloc" : ("", "build/chattymalloc.so")}
+analyse_targets = {"chattymalloc" : {"LD_PRELOAD" : "build/chattymalloc.so"}}
diff --git a/falsesharing.py b/falsesharing.py
index 2d8c5f0..b5d7a9f 100644
--- a/falsesharing.py
+++ b/falsesharing.py
@@ -55,11 +55,11 @@ class Benchmark_Falsesharing( Benchmark ):
for tname, t in self.targets.items():
result = {}
- os.environ["LD_PRELOAD"] = t[1]
+ os.environ["LD_PRELOAD"] = t["LD_PRELOAD"]
for bench in ["thrash", "scratch"]:
- target_cmd = cmd.format(bench, t[0], threads).split(" ")
+ target_cmd = cmd.format(bench, t["binary_suffix"], threads).split(" ")
if verbose:
print("\n" + tname, t, "\n", " ".join(target_cmd), "\n")
@@ -81,7 +81,7 @@ class Benchmark_Falsesharing( Benchmark ):
return False
if "ERROR: ld.so" in output:
- print("\nPreloading of", t[1], "failed for", tname,
+ print("\nPreloading of", t["LD_PRELOAD"], "failed for", tname,
".\n Aborting Benchmark.")
print(output)
return False
@@ -129,7 +129,7 @@ class Benchmark_Falsesharing( Benchmark ):
y_vals[y_mapping[mid[1]]] = single_threaded / np.mean(d)
s = "{} {} {}: {:.3f}%".format(bench, target, mid[1], np.mean(l1_load_misses)*100)
print(s)
- plt.plot(nthreads, y_vals, marker='.', linestyle='-', label=target)
+ plt.plot(nthreads, y_vals, marker='.', linestyle='-', label=target, color=targets[target]["color"])
plt.legend()
plt.xlabel("threads")
diff --git a/loop.py b/loop.py
index 7fc74e5..0aea9d3 100644
--- a/loop.py
+++ b/loop.py
@@ -55,9 +55,9 @@ class Benchmark_Loop( Benchmark ):
for tname, t in self.targets.items():
result = {"heap_start": 0, "heap_end" : 0}
- os.environ["LD_PRELOAD"] = t[1]
+ os.environ["LD_PRELOAD"] = t["LD_PRELOAD"]
- target_cmd = cmd.format(t[0], *args).split(" ")
+ target_cmd = cmd.format(t["binary_suffix"], *args).split(" ")
if verbose:
print("\n" + tname, t, "\n", " ".join(target_cmd), "\n")
@@ -96,7 +96,7 @@ class Benchmark_Loop( Benchmark ):
return False
if "ERROR: ld.so" in output:
- print("\nPreloading of", t[1], "failed for", tname, ".\n Aborting Benchmark.")
+ print("\nPreloading of", t["LD_PRELOAD"], "failed for", tname, ".\n Aborting Benchmark.")
print(output)
return False
@@ -133,7 +133,7 @@ class Benchmark_Loop( Benchmark ):
if "cpu-clock" in e:
d.append(mid[1]/float(m[e]))
y_vals[y_mapping[mid[1]]] = np.mean(d)
- plt.plot(nthreads, y_vals, marker='.', linestyle='-', label=target)
+ plt.plot(nthreads, y_vals, marker='.', linestyle='-', label=target, color=targets[target]["color"])
plt.legend()
plt.xlabel("threads")
@@ -157,7 +157,7 @@ class Benchmark_Loop( Benchmark ):
if "cpu-clock" in e:
d.append(mid[1]/float(m[e]))
y_vals[y_mapping[mid[2]]] = np.mean(d)
- plt.plot(x_vals, y_vals, marker='.', linestyle='-', label=target)
+ plt.plot(x_vals, y_vals, marker='.', linestyle='-', label=target, color=targets[target]["color"])
plt.legend()
plt.xticks(x_vals, maxsize)
diff --git a/mysql.py b/mysql.py
index 9d3811c..9bd8ce8 100644
--- a/mysql.py
+++ b/mysql.py
@@ -116,8 +116,7 @@ class Benchmark_MYSQL( Benchmark ):
# run cmd for each target
n = len(self.nthreads)
for tname, t in self.targets.items():
- # No custom build mysqld server supported yet.
- os.environ["LD_PRELOAD"] = t[1] # set LD_PRELOAD
+ os.environ["LD_PRELOAD"] = t["LD_PRELOAD"] # set LD_PRELOAD
log = "mysqld.log"
if tname == "chattymalloc":
@@ -213,7 +212,7 @@ class Benchmark_MYSQL( Benchmark ):
for m in measures:
d.append(int(m["transactions"]))
y_vals[y_mapping[mid[1]]] = np.mean(d)
- plt.plot(nthreads, y_vals, label=target, linestyle='-', marker='.')
+ plt.plot(nthreads, y_vals, label=target, linestyle='-', marker='.', color=targets[target]["color"])
plt.legend()
plt.xlabel("threads")
@@ -230,6 +229,7 @@ class Benchmark_MYSQL( Benchmark ):
for i, target in enumerate(targets):
if target == "chattymalloc":
continue
+ x_vals = [x-i/8 for x in range(1, len(nthreads) + 1)]
y_vals = [0] * len(nthreads)
for mid, measures in self.results.items():
if mid[0] == target:
@@ -237,7 +237,7 @@ class Benchmark_MYSQL( Benchmark ):
for m in measures:
d.append(int(m["transactions"]))
y_vals[y_mapping[mid[1]]] = np.mean(d)
- plt.bar([x-i/8 for x in range(1, len(nthreads) + 1)], y_vals, width=0.2, label=target, align="center")
+ plt.bar(x_vals, y_vals, width=0.2, label=target, align="center", color=targets[target]["color"])
plt.legend()
plt.xlabel("threads")