diff options
| -rw-r--r-- | src/benchmark.py | 6 | ||||
| -rw-r--r-- | src/benchmarks/dj_trace.py | 18 | ||||
| -rw-r--r-- | src/benchmarks/falsesharing.py | 4 | ||||
| -rw-r--r-- | src/benchmarks/lld.py | 3 | ||||
| -rw-r--r-- | src/globalvars.py | 2 |
5 files changed, 20 insertions, 13 deletions
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<time>\\d*\\.\\d*) seconds.$") @@ -77,7 +79,7 @@ class BenchmarkFalsesharing(Benchmark): plt.xlabel("threads") plt.ylabel("speedup") plt.title(bench + " speedup") - plt.savefig(self.name + "." + bench + ".png") + plt.savefig(f"{self.name}.{bench}.{summary_file_ext}") plt.clf() self.plot_fixed_arg("({L1-dcache-load-misses}/{L1-dcache-loads})*100", diff --git a/src/benchmarks/lld.py b/src/benchmarks/lld.py index df19ebf..1c30ce0 100644 --- a/src/benchmarks/lld.py +++ b/src/benchmarks/lld.py @@ -205,6 +205,7 @@ import matplotlib.pyplot as plt from src.artifact import ArchiveArtifact from src.benchmark import Benchmark import src.facter +from src.globalvars import summary_file_ext class BenchmarkLld(Benchmark): @@ -257,7 +258,7 @@ class BenchmarkLld(Benchmark): plt.legend(loc="best") plt.ylabel("Zeit in ms") plt.title(f"Gesamte Laufzeit {perm.test}") - plt.savefig(".".join([self.name, perm.test, "runtime", "png"])) + plt.savefig(".".join([self.name, perm.test, "runtime", summary_file_ext])) plt.clf() # TODO: get memusage diff --git a/src/globalvars.py b/src/globalvars.py index 98434c3..c1ec6b0 100644 --- a/src/globalvars.py +++ b/src/globalvars.py @@ -63,3 +63,5 @@ resdir = None benchmarks = [e[:-3] for e in os.listdir(os.path.join(allocbenchdir, benchsrcdir)) if e[-3:] == ".py" and e != "__init__.py"] + +summary_file_ext = "svg" |
