From 37d0d9b4b37ca15cf0ee1937b94fe47142f18e5a Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 7 Aug 2018 16:45:38 +0200 Subject: make loop and falsesharing work with different perf outputs --- falsesharing.py | 9 +++++++-- loop.py | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/falsesharing.py b/falsesharing.py index e04e7cf..2d8c5f0 100644 --- a/falsesharing.py +++ b/falsesharing.py @@ -118,8 +118,13 @@ class Benchmark_Falsesharing( Benchmark ): d = [] for m in measures: d.append(m["time"]) - misses = float(m["L1-dcache-load-misses"]) - loads = float(m["L1-dcache-loads"]) + misses = 0 + loads = 0 + for e in m: + if "L1-dcache-load-misses" in e: + misses = float(m[e]) + elif "L1-dcache-loads" in e: + loads = float(m[e]) l1_load_misses.append(misses/loads) y_vals[y_mapping[mid[1]]] = single_threaded / np.mean(d) s = "{} {} {}: {:.3f}%".format(bench, target, mid[1], np.mean(l1_load_misses)*100) diff --git a/loop.py b/loop.py index e50f7b7..7fc74e5 100644 --- a/loop.py +++ b/loop.py @@ -129,7 +129,9 @@ class Benchmark_Loop( Benchmark ): d = [] for m in measures: # nthreads/time = MOPS/s - d.append(mid[1]/float(m["cpu-clock"])) + for e in m: + 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) @@ -151,7 +153,9 @@ class Benchmark_Loop( Benchmark ): d = [] for m in measures: # nthreads/time = MOPS/S - d.append(n/float(m["cpu-clock"])) + for e in m: + 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) -- cgit v1.2.3