diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2019-03-25 17:51:06 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2019-03-25 17:51:06 +0100 |
| commit | 7f19d36ced806ffd138c4b48de6145068cc4f0b3 (patch) | |
| tree | 263c38a2fe0054acb6ef2bc77df377c5bb9693e9 | |
| parent | 25c4d81069f576354d0279bf38417c236e924540 (diff) | |
| download | allocbench-7f19d36ced806ffd138c4b48de6145068cc4f0b3.tar.gz allocbench-7f19d36ced806ffd138c4b48de6145068cc4f0b3.zip | |
add export_to_csv and use it in the loop benchmark
| -rw-r--r-- | src/benchmark.py | 44 | ||||
| -rw-r--r-- | src/benchmarks/loop.py | 3 |
2 files changed, 46 insertions, 1 deletions
diff --git a/src/benchmark.py b/src/benchmark.py index fc77915..2fea8df 100644 --- a/src/benchmark.py +++ b/src/benchmark.py @@ -333,7 +333,7 @@ class Benchmark (object): y_vals = [] for perm in self.iterate_args(args=args): if scale: - if scale == allocator + if scale == allocator: y_vals = [1] * len(x_vals) else: mean = eval(yval.format(**self.results["mean"][allocator][perm])) @@ -390,6 +390,48 @@ class Benchmark (object): str(arg_value), filepostfix, file_ext]))) plt.clf() + def export_to_csv(self, datapoints=None, path=None, std=True): + args = self.results["args"] + allocators = self.results["allocators"] + + if path is None: + if datapoints is not None: + path = ".".join(datapoints) + else: + path = "full" + + path = path + ".csv" + + if datapoints is None: + first_alloc = list(allocators)[0] + first_perm = list(self.results[first_alloc])[0] + datapoints = list(self.results[first_alloc][first_perm]) + + for allocator in self.results["allocators"]: + path_alloc = allocator + '_' + path + with open(path_alloc, "w") as f: + fieldnames = [*args] + for d in datapoints: + fieldnames.append(d) + if std: + fieldnames.append(d + "(std)") + + writer = csv.DictWriter(f, fieldnames, delimiter="\t", + lineterminator='\n') + writer.writeheader() + + for perm in self.iterate_args(args=args): + d = {} + d.update(perm._asdict()) + + for dp in datapoints: + d[dp] = self.results["mean"][allocator][perm][dp] + if std: + fieldname = dp + "(std)" + d[fieldname] = self.results["std"][allocator][perm][dp] + + writer.writerow(d) + def write_best_doublearg_tex_table(self, evaluation, sort=">", filepostfix="", sumdir="", std=False): args = self.results["args"] diff --git a/src/benchmarks/loop.py b/src/benchmarks/loop.py index 4683549..bf12b1e 100644 --- a/src/benchmarks/loop.py +++ b/src/benchmarks/loop.py @@ -32,5 +32,8 @@ class Benchmark_Loop(Benchmark): self.write_best_doublearg_tex_table("perm.nthreads / ({task-clock}/1000)", filepostfix="memusage.matrix") + self.export_to_csv(datapoints=["task-clock", "L1-dcache-load-misses", + "L1-dcache-loads"]) + loop = Benchmark_Loop() |
