diff options
| -rw-r--r-- | falsesharing.py | 9 | ||||
| -rw-r--r-- | 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) @@ -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) |
