From 37c3d391c812aff94754c6c80bec3e61982e00a1 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 30 Oct 2019 10:46:38 +0100 Subject: introduce a global summary file extension --- src/benchmark.py | 6 +++--- src/benchmarks/dj_trace.py | 18 ++++++++++-------- src/benchmarks/falsesharing.py | 4 +++- src/benchmarks/lld.py | 3 ++- src/globalvars.py | 2 ++ 5 files changed, 20 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/benchmark.py b/src/benchmark.py index fd99fc4..0df2bc3 100644 --- a/src/benchmark.py +++ b/src/benchmark.py @@ -533,7 +533,7 @@ class Benchmark: ###### Summary helpers ###### def plot_single_arg(self, yval, ylabel="'y-label'", xlabel="'x-label'", autoticks=True, title="'default title'", filepostfix="", - sumdir="", arg="", scale=None, file_ext="png"): + sumdir="", arg="", scale=None, file_ext=src.globalvars.summary_file_ext): args = self.results["args"] allocators = self.results["allocators"] @@ -572,7 +572,7 @@ class Benchmark: def barplot_single_arg(self, yval, ylabel="'y-label'", xlabel="'x-label'", title="'default title'", filepostfix="", sumdir="", - arg="", scale=None, file_ext="png", yerr=True): + arg="", scale=None, file_ext=src.globalvars.summary_file_ext, yerr=True): args = self.results["args"] allocators = self.results["allocators"] @@ -621,7 +621,7 @@ class Benchmark: def plot_fixed_arg(self, yval, ylabel="'y-label'", xlabel="loose_arg", autoticks=True, title="'default title'", filepostfix="", - sumdir="", fixed=[], file_ext="png", scale=None): + sumdir="", fixed=[], file_ext=src.globalvars.summary_file_ext, scale=None): args = self.results["args"] allocators = self.results["allocators"] diff --git a/src/benchmarks/dj_trace.py b/src/benchmarks/dj_trace.py index 0e9ee74..3f87e86 100644 --- a/src/benchmarks/dj_trace.py +++ b/src/benchmarks/dj_trace.py @@ -25,6 +25,8 @@ from urllib.request import urlretrieve import matplotlib.pyplot as plt import numpy as np +from src.globalvars import summary_file_ext + from src.artifact import ArchiveArtifact from src.benchmark import Benchmark from src.util import print_status @@ -156,7 +158,7 @@ class BenchmarkDJTrace(Benchmark): plt.legend(loc="best") plt.ylabel("Zeit in ms") plt.title("Gesamte Laufzeit") - plt.savefig(".".join([self.name, perm.workload, "runtime", "png"])) + plt.savefig(".".join([self.name, perm.workload, "runtime", summary_file_ext])) plt.clf() self.barplot_single_arg("{cputime}/1000", @@ -190,7 +192,7 @@ class BenchmarkDJTrace(Benchmark): "free\n" + str(self.results[perm.workload]["free"]) + "\ncalls"]) plt.ylabel("Durchschnittliche Zeit in cycles") plt.title("Durchscnittliche Laufzeiten der API Funktionen") - plt.savefig(".".join([self.name, perm.workload, "apitimes", "png"])) + plt.savefig(".".join([self.name, perm.workload, "apitimes", summary_file_ext])) plt.clf() # Memusage @@ -227,7 +229,7 @@ class BenchmarkDJTrace(Benchmark): plt.legend(loc="best") plt.ylabel("Max RSS in MB") plt.title("Maximal benötigter Speicher (VmHWM)") - plt.savefig(".".join([self.name, perm.workload, "rss", "png"])) + plt.savefig(".".join([self.name, perm.workload, "rss", summary_file_ext])) plt.clf() self.export_stats_to_csv("Max_RSS") @@ -245,12 +247,12 @@ class BenchmarkDJTrace(Benchmark): d[allocator]["rss"] = [x["Max_RSS"] for x in self.results[allocator][perm]] times = {allocator: np.mean(d[allocator]["time"]) for allocator in allocators} - tmin = min(times) - tmax = max(times) + tmin = min(times.values()) + tmax = max(times.values()) rss = {allocator: np.mean(d[allocator]["rss"]) for allocator in allocators} - rssmin = min(rss) - rssmax = max(rss) + rssmin = min(rss.values()) + rssmax = max(rss.values()) fname = ".".join([self.name, perm.workload, "table.tex"]) with open(fname, "w") as f: @@ -264,7 +266,7 @@ class BenchmarkDJTrace(Benchmark): for allocator in allocators: print(allocator.replace("_", "\\_"), end=" & ", file=f) - s = "\\textcolor{{{}}}{{{}}} / {}" + s = "\\textcolor{{{}}}{{{:.2f}}} / {:.4f}" t = d[allocator]["time"] m = times[allocator] diff --git a/src/benchmarks/falsesharing.py b/src/benchmarks/falsesharing.py index a9c72b5..b7222f6 100644 --- a/src/benchmarks/falsesharing.py +++ b/src/benchmarks/falsesharing.py @@ -23,6 +23,8 @@ import matplotlib.pyplot as plt import numpy as np from src.benchmark import Benchmark +from src.globalvars import summary_file_ext + TIME_RE = re.compile("^Time elapsed = (?P