From 60b860ce3619d5f165bf8eda6ad596d5d458d1e2 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 11 Feb 2020 13:23:55 +0100 Subject: move plotting code from src.benchmark to src.plots --- src/benchmarks/espresso.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'src/benchmarks/espresso.py') diff --git a/src/benchmarks/espresso.py b/src/benchmarks/espresso.py index 2f8b8bf..1c9d4d2 100644 --- a/src/benchmarks/espresso.py +++ b/src/benchmarks/espresso.py @@ -59,6 +59,7 @@ import os from src.benchmark import Benchmark import src.globalvars +import src.plots as plt class BenchmarkEspresso(Benchmark): @@ -79,13 +80,15 @@ class BenchmarkEspresso(Benchmark): def summary(self): # Speed - self.barplot_single_arg("{task-clock}/1000", - ylabel='"cpu-second"', - title='"Espresso: runtime"', - filepostfix="time") + plt.barplot_single_arg(self, + "{task-clock}/1000", + ylabel='"cpu-second"', + title='"Espresso: runtime"', + filepostfix="time") # L1 cache misses - self.barplot_single_arg( + plt.barplot_single_arg( + self, "({L1-dcache-load-misses}/{L1-dcache-loads})*100", ylabel='"L1 misses in %"', title='"Espresso l1 cache misses"', @@ -93,12 +96,13 @@ class BenchmarkEspresso(Benchmark): yerr=False) # Memusage - self.barplot_single_arg("{VmHWM}", - ylabel='"VmHWM in KB"', - title='"Espresso VmHWM"', - filepostfix="vmhwm") + plt.barplot_single_arg(self, + "{VmHWM}", + ylabel='"VmHWM in KB"', + title='"Espresso VmHWM"', + filepostfix="vmhwm") - self.write_tex_table([{ + plt.write_tex_table(self, [{ "label": "Runtime [ms]", "expression": "{task-clock}", "sort": "<" @@ -107,11 +111,11 @@ class BenchmarkEspresso(Benchmark): "expression": "{VmHWM}", "sort": "<" }], - filepostfix="table") + filepostfix="table") - self.export_stats_to_dataref("task-clock") + plt.export_stats_to_dataref(self, "task-clock") - self.export_stats_to_dataref("VmHWM") + plt.export_stats_to_dataref(self, "VmHWM") espresso = BenchmarkEspresso() -- cgit v1.2.3 From 5d6a470ce0c7d334205293de9b596a5ea4eb2e8c Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 11 Feb 2020 14:22:07 +0100 Subject: cleanup plot code * use str.format instead of eval for plot labels * use meaningful variable names * add license header * add some doc strings --- src/benchmarks/espresso.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/benchmarks/espresso.py') diff --git a/src/benchmarks/espresso.py b/src/benchmarks/espresso.py index 1c9d4d2..5149dcb 100644 --- a/src/benchmarks/espresso.py +++ b/src/benchmarks/espresso.py @@ -82,24 +82,24 @@ class BenchmarkEspresso(Benchmark): # Speed plt.barplot_single_arg(self, "{task-clock}/1000", - ylabel='"cpu-second"', - title='"Espresso: runtime"', + ylabel="cpu-second", + title="Espresso: runtime", filepostfix="time") # L1 cache misses plt.barplot_single_arg( self, "({L1-dcache-load-misses}/{L1-dcache-loads})*100", - ylabel='"L1 misses in %"', - title='"Espresso l1 cache misses"', + ylabel="L1 misses in %", + title="Espresso l1 cache misses", filepostfix="l1misses", yerr=False) # Memusage plt.barplot_single_arg(self, "{VmHWM}", - ylabel='"VmHWM in KB"', - title='"Espresso VmHWM"', + ylabel="VmHWM in KB", + title="Espresso VmHWM", filepostfix="vmhwm") plt.write_tex_table(self, [{ -- cgit v1.2.3