From 9cf7987ca27bcc54c1326c2d7256543a332c3ff1 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 21 Feb 2020 14:19:38 +0100 Subject: use plots from src.plots --- src/benchmarks/cfrac.py | 2 +- src/benchmarks/keydb.py | 5 +++-- src/benchmarks/lld.py | 6 +++--- src/benchmarks/mysql.py | 17 +++++++++-------- src/benchmarks/realloc.py | 7 ++++--- src/benchmarks/redis.py | 8 ++++---- src/benchmarks/t_test1.py | 11 ++++++----- 7 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/benchmarks/cfrac.py b/src/benchmarks/cfrac.py index 59c8858..07385eb 100644 --- a/src/benchmarks/cfrac.py +++ b/src/benchmarks/cfrac.py @@ -98,7 +98,7 @@ class BenchmarkCfrac(Benchmark): title="Cfrac VmHWM", filepostfix="vmhwm") - self.write_tex_table([{ + plt.write_tex_table(self, [{ "label": "Runtime [ms]", "expression": "{task-clock}", "sort": "<" diff --git a/src/benchmarks/keydb.py b/src/benchmarks/keydb.py index a77de76..2b831eb 100644 --- a/src/benchmarks/keydb.py +++ b/src/benchmarks/keydb.py @@ -26,6 +26,7 @@ from multiprocessing import cpu_count from src.artifact import GitArtifact from src.benchmark import Benchmark +import src.plots as plt from src.util import print_info, run_cmd @@ -109,12 +110,12 @@ class BenchmarkKeyDB(Benchmark): os.remove("dump.rdb") def summary(self): - self.plot_fixed_arg("{totals_ops}", + plt.plot_fixed_arg(self, "{totals_ops}", ylabel="'OPS/second'", title="'KeyDB Operations: ' + str(perm)", filepostfix="total_ops") - self.plot_fixed_arg("{keydb_vmhwm}", + plt.plot_fixed_arg(self, "{keydb_vmhwm}", ylabel="'VmHWM [KB]'", title="'KeyDB Memusage: ' + str(perm)", filepostfix="vmhwm") diff --git a/src/benchmarks/lld.py b/src/benchmarks/lld.py index b2da35b..a9fe26c 100644 --- a/src/benchmarks/lld.py +++ b/src/benchmarks/lld.py @@ -284,12 +284,12 @@ class BenchmarkLld(Benchmark): plt.clf() # self.export_stats_to_csv("VmHWM") - src.plots.export_stats_to_csv("task-clock") + src.plots.export_stats_to_csv(self, "task-clock") # self.export_stats_to_dataref("VmHWM") - src.plots.export_stats_to_dataref("task-clock") + src.plots.export_stats_to_dataref(self, "task-clock") - src.plots.write_tex_table([{ + src.plots.write_tex_table(self, [{ "label": "Runtime [ms]", "expression": "{task-clock}", "sort": "<" diff --git a/src/benchmarks/mysql.py b/src/benchmarks/mysql.py index bf4da99..345a675 100644 --- a/src/benchmarks/mysql.py +++ b/src/benchmarks/mysql.py @@ -82,6 +82,7 @@ import numpy as np from src.benchmark import Benchmark import src.facter +import src.plots as plt from src.util import print_status, print_debug, print_info2, print_warn, run_cmd MYSQL_USER = "root" @@ -200,7 +201,7 @@ class BenchmarkMYSQL(Benchmark): args = self.results["args"] # linear plot - self.plot_single_arg("{transactions}", + plt.plot_single_arg(self, "{transactions}", xlabel='"threads"', ylabel='"transactions"', title='"sysbench oltp read only"', @@ -208,7 +209,7 @@ class BenchmarkMYSQL(Benchmark): # normalized linear plot ref_alloc = list(allocators)[0] - self.plot_single_arg("{transactions}", + plt.plot_single_arg(self, "{transactions}", xlabel='"threads"', ylabel='"transactions scaled at " + scale', title='"sysbench oltp read only"', @@ -216,14 +217,14 @@ class BenchmarkMYSQL(Benchmark): scale=ref_alloc) # bar plot - self.barplot_single_arg("{transactions}", + plt.barplot_single_arg(self, "{transactions}", xlabel='"threads"', ylabel='"transactions"', title='"sysbench oltp read only"', filepostfix="b") # normalized bar plot - self.barplot_single_arg("{transactions}", + plt.barplot_single_arg(self, "{transactions}", xlabel='"threads"', ylabel='"transactions scaled at " + scale', title='"sysbench oltp read only"', @@ -231,13 +232,13 @@ class BenchmarkMYSQL(Benchmark): scale=ref_alloc) # Memusage - self.barplot_single_arg("{mysqld_vmhwm}", + plt.barplot_single_arg(self, "{mysqld_vmhwm}", xlabel='"threads"', ylabel='"VmHWM in kB"', title='"Memusage sysbench oltp read only"', filepostfix="mem") - self.write_tex_table([{ + plt.write_tex_table(self, [{ "label": "Transactions", "expression": "{transactions}", "sort": ">" @@ -299,8 +300,8 @@ class BenchmarkMYSQL(Benchmark): print("\\end{tabular}", file=f) - self.export_stats_to_csv("transactions") - self.export_stats_to_dataref("transactions") + plt.export_stats_to_csv(self, "transactions") + plt.export_stats_to_dataref(self, "transactions") mysql = BenchmarkMYSQL() diff --git a/src/benchmarks/realloc.py b/src/benchmarks/realloc.py index 952913f..251185e 100644 --- a/src/benchmarks/realloc.py +++ b/src/benchmarks/realloc.py @@ -16,6 +16,7 @@ # along with allocbench. If not, see . """Definition of the realloc micro benchmark""" +import src.plots as plt from src.benchmark import Benchmark @@ -33,13 +34,13 @@ class BenchmarkRealloc(Benchmark): super().__init__(name) def summary(self): - self.barplot_single_arg("{task-clock}", + plt.barplot_single_arg(self, "{task-clock}", ylabel='"task-clock in ms"', title='"realloc micro benchmark"', filepostfix="time") - self.export_stats_to_csv("task-clock") - self.export_stats_to_dataref("task-clock") + plt.export_stats_to_csv(self, "task-clock") + plt.export_stats_to_dataref(self, "task-clock") realloc = BenchmarkRealloc() diff --git a/src/benchmarks/redis.py b/src/benchmarks/redis.py index 23c2de6..71d9227 100644 --- a/src/benchmarks/redis.py +++ b/src/benchmarks/redis.py @@ -24,10 +24,10 @@ archive. The used parameters are inspired by the ones used in mimalloc-bench." import os import re import sys -from urllib.request import urlretrieve from src.artifact import ArchiveArtifact from src.benchmark import Benchmark +import src.plots as plt from src.util import print_info, run_cmd REQUESTS_RE = re.compile("(?P(\\d*.\\d*)) requests per second") @@ -81,17 +81,17 @@ class BenchmarkRedis(Benchmark): os.remove("dump.rdb") def summary(self): - self.barplot_single_arg("{requests}", + plt.barplot_single_arg(self, "{requests}", ylabel='"requests per s"', title='"redis throughput"', filepostfix="requests") - self.barplot_single_arg("{redis_vmhwm}", + plt.barplot_single_arg(self, "{redis_vmhwm}", ylabel='"VmHWM in KB"', title='"redis memusage"', filepostfix="vmhwm") - self.export_stats_to_dataref("requests") + plt.export_stats_to_dataref(self, "requests") redis = BenchmarkRedis() diff --git a/src/benchmarks/t_test1.py b/src/benchmarks/t_test1.py index bdc7c83..119f2a5 100644 --- a/src/benchmarks/t_test1.py +++ b/src/benchmarks/t_test1.py @@ -17,6 +17,7 @@ """Definition of the commonly used t-test1 allocator test""" from src.benchmark import Benchmark +import src.plots as plt class BenchmarkTTest1(Benchmark): @@ -41,14 +42,14 @@ class BenchmarkTTest1(Benchmark): # mops / per second yval = "perm.nthreads / ({task-clock}/1000)" # Speed - self.plot_fixed_arg(yval, + plt.plot_fixed_arg(self, yval, ylabel='"Mops / CPU second"', title='"T-Ttest1: " + arg + " " + str(arg_value)', filepostfix="time", autoticks=False) # L1 cache misses - self.plot_fixed_arg( + plt.plot_fixed_arg(self, "({L1-dcache-load-misses}/{L1-dcache-loads})*100", ylabel='"L1 misses in %"', title='"T-Test1 l1 cache misses: " + arg + " " + str(arg_value)', @@ -56,16 +57,16 @@ class BenchmarkTTest1(Benchmark): autoticks=False) # Speed Matrix - self.write_best_doublearg_tex_table(yval, filepostfix="mops.matrix") + plt.write_best_doublearg_tex_table(self, yval, filepostfix="mops.matrix") - self.write_tex_table([{ + plt.write_tex_table(self, [{ "label": "MOPS/s", "expression": yval, "sort": ">" }], filepostfix="mops.table") - self.export_stats_to_csv("task-clock") + plt.export_stats_to_csv(self, "task-clock") t_test1 = BenchmarkTTest1() -- cgit v1.2.3