diff options
Diffstat (limited to 'src/benchmarks')
| -rw-r--r-- | src/benchmarks/dj_trace.py | 28 | ||||
| -rw-r--r-- | src/benchmarks/falsesharing.py | 2 | ||||
| -rw-r--r-- | src/benchmarks/httpd.py | 43 | ||||
| -rw-r--r-- | src/benchmarks/larson.py | 3 | ||||
| -rw-r--r-- | src/benchmarks/mysql.py | 27 | ||||
| -rw-r--r-- | src/benchmarks/realloc.py | 5 |
6 files changed, 45 insertions, 63 deletions
diff --git a/src/benchmarks/dj_trace.py b/src/benchmarks/dj_trace.py index b808f4d..4d08de4 100644 --- a/src/benchmarks/dj_trace.py +++ b/src/benchmarks/dj_trace.py @@ -8,7 +8,7 @@ import re from src.benchmark import Benchmark from src.util import print_status -comma_sep_number_re = "(?:\d*(?:,\d*)?)*" +comma_sep_number_re = "(?:\\d*(?:,\\d*)?)*" rss_re = "(?P<rss>" + comma_sep_number_re + ")" time_re = "(?P<time>" + comma_sep_number_re + ")" @@ -18,10 +18,10 @@ cpu_time_re = re.compile("^{} usec across.*threads$".format(time_re)) max_rss_re = re.compile("^{} Kb Max RSS".format(rss_re)) ideal_rss_re = re.compile("^{} Kb Max Ideal RSS".format(rss_re)) -malloc_re = re.compile("^Avg malloc time:\s*{} in.*calls$".format(time_re)) -calloc_re = re.compile("^Avg calloc time:\s*{} in.*calls$".format(time_re)) -realloc_re = re.compile("^Avg realloc time:\s*{} in.*calls$".format(time_re)) -free_re = re.compile("^Avg free time:\s*{} in.*calls$".format(time_re)) +malloc_re = re.compile("^Avg malloc time:\\s*{} in.*calls$".format(time_re)) +calloc_re = re.compile("^Avg calloc time:\\s*{} in.*calls$".format(time_re)) +realloc_re = re.compile("^Avg realloc time:\\s*{} in.*calls$".format(time_re)) +free_re = re.compile("^Avg free time:\\s*{} in.*calls$".format(time_re)) class Benchmark_DJ_Trace(Benchmark): @@ -111,16 +111,16 @@ class Benchmark_DJ_Trace(Benchmark): file_name = wl + ".wl" file_path = os.path.join("dj_workloads", file_name) if not os.path.isfile(file_path): - if download_all == None: - choice = input(("Download all missing workloads (upto 6.7GB)" - " [Y/n/x] ")) + if download_all is None: + choice = input(("Download all missing workloads" + " (upto 6.7GB) [Y/n/x] ")) if choice == "x": break else: download_all = choice in ['', 'Y', 'y'] if (not download_all and - input("want to download {} ({}) [Y/n] ".format(wl, wl_sizes[wl])) not in ['', 'Y', 'y']): + input("want to download {} ({}) [Y/n] ".format(wl, wl_sizes[wl])) not in ['', 'Y', 'y']): continue if download_all: @@ -140,7 +140,7 @@ class Benchmark_DJ_Trace(Benchmark): if len(available_workloads) > 0: self.args["workload"] = available_workloads return True - + return False def process_output(self, result, stdout, stderr, allocator, perm, verbose): @@ -187,7 +187,6 @@ class Benchmark_DJ_Trace(Benchmark): plt.savefig(".".join([self.name, perm.workload, "runtime", "png"])) plt.clf() - self.barplot_single_arg("{cputime}/1000", ylabel='"time in ms"', title='"total runtime"', @@ -200,7 +199,7 @@ class Benchmark_DJ_Trace(Benchmark): for i, allocator in enumerate(allocators): x_vals = [x+i/len(allocators) for x in xa] - func_times_means[allocator][perm] = [0,0,0,0] + func_times_means[allocator][perm] = [0, 0, 0, 0] func_times_means[allocator][perm][0] = np.mean([x["avg_malloc"] for x in self.results[allocator][perm]]) func_times_means[allocator][perm][1] = np.mean([x["avg_calloc"] for x in self.results[allocator][perm]]) @@ -230,7 +229,6 @@ class Benchmark_DJ_Trace(Benchmark): ideal_rss = self.results[list(allocators.keys())[0]][perm][0]["Ideal_RSS"]/1000 self.results["stats"]["Ideal_RSS"][perm] = {"mean": {"Max_RSS": ideal_rss}} - self.barplot_single_arg("{Max_RSS}/1000", ylabel='"Max RSS in MB"', title='"Highwatermark of Vm (VmHWM)"', @@ -315,7 +313,7 @@ class Benchmark_DJ_Trace(Benchmark): color = "black" print(s.format(color, m, np.std(t)/m if m else 0), "\\\\", file=f) - print("\end{tabular}", file=f) + print("\\end{tabular}", file=f) print("\\end{document}", file=f) # Create summary similar to DJ's at @@ -377,7 +375,7 @@ class Benchmark_DJ_Trace(Benchmark): times[1], times[2], times[3], rss), file=f) print(file=f) - tmeans = [0,0,0,0] + tmeans = [0, 0, 0, 0] for i in range(0, len(times)): tmeans[i] = np.mean([times[i] for times in times_change_means]) print(fmt_changes.format("Mean:", np.mean(cycles_change_means), diff --git a/src/benchmarks/falsesharing.py b/src/benchmarks/falsesharing.py index f1d69ca..85d0a92 100644 --- a/src/benchmarks/falsesharing.py +++ b/src/benchmarks/falsesharing.py @@ -4,7 +4,7 @@ import re from src.benchmark import Benchmark -time_re = re.compile("^Time elapsed = (?P<time>\d*\.\d*) seconds.$") +time_re = re.compile("^Time elapsed = (?P<time>\\d*\\.\\d*) seconds.$") class Benchmark_Falsesharing(Benchmark): diff --git a/src/benchmarks/httpd.py b/src/benchmarks/httpd.py index 0e386cc..2ac7fbc 100644 --- a/src/benchmarks/httpd.py +++ b/src/benchmarks/httpd.py @@ -1,14 +1,6 @@ -import matplotlib.pyplot as plt -import numpy as np import re -import shutil -import subprocess -from subprocess import PIPE -import sys -from time import sleep from src.benchmark import Benchmark -from src.util import * class Benchmark_HTTPD(Benchmark): @@ -28,8 +20,8 @@ class Benchmark_HTTPD(Benchmark): super().__init__() def process_output(self, result, stdout, stderr, allocator, perm, verbose): - result["time"] = re.search("Time taken for tests:\s*(\d*\.\d*) seconds", stdout).group(1) - result["requests"] = re.search("Requests per second:\s*(\d*\.\d*) .*", stdout).group(1) + result["time"] = re.search("Time taken for tests:\\s*(\\d*\\.\\d*) seconds", stdout).group(1) + result["requests"] = re.search("Requests per second:\\s*(\\d*\\.\\d*) .*", stdout).group(1) # with open("/proc/"+str(self.server.pid)+"/status", "r") as f: # for l in f.readlines(): @@ -39,34 +31,33 @@ class Benchmark_HTTPD(Benchmark): def summary(self): allocators = self.results["allocators"] - args = self.results["args"] self.calc_desc_statistics() # linear plot self.plot_fixed_arg("{requests}", - xlabel='"threads"', - ylabel='"requests/s"', - autoticks=False, - filepostfix="requests", - title='"ab -n 10000 -c " + str(perm.nthreads)') + xlabel='"threads"', + ylabel='"requests/s"', + autoticks=False, + filepostfix="requests", + title='"ab -n 10000 -c " + str(perm.nthreads)') # linear plot ref_alloc = list(allocators)[0] self.plot_fixed_arg("{requests}", - xlabel='"threads"', - ylabel='"requests/s scaled at " + scale', - title='"ab -n 10000 -c " + str(perm.nthreads) + " (normalized)"', - filepostfix="requests.norm", - autoticks=False, - scale=ref_alloc) + xlabel='"threads"', + ylabel='"requests/s scaled at " + scale', + title='"ab -n 10000 -c " + str(perm.nthreads) + " (normalized)"', + filepostfix="requests.norm", + autoticks=False, + scale=ref_alloc) # bar plot # self.barplot_fixed_arg("{requests}", - # xlabel='"threads"', - # ylabel='"requests/s"', - # filepostfix="b", - # title='"ab -n 10000 -c threads"') + # xlabel='"threads"', + # ylabel='"requests/s"', + # filepostfix="b", + # title='"ab -n 10000 -c threads"') httpd = Benchmark_HTTPD() diff --git a/src/benchmarks/larson.py b/src/benchmarks/larson.py index e070b7b..910fdf6 100644 --- a/src/benchmarks/larson.py +++ b/src/benchmarks/larson.py @@ -2,7 +2,7 @@ import re from src.benchmark import Benchmark -throughput_re = re.compile("^Throughput =\s*(?P<throughput>\d+) operations per second.$") +throughput_re = re.compile("^Throughput =\\s*(?P<throughput>\\d+) operations per second.$") class Benchmark_Larson(Benchmark): @@ -43,4 +43,5 @@ class Benchmark_Larson(Benchmark): title="'Larson cache misses: ' + arg + ' ' + str(arg_value)", filepostfix="cachemisses") + larson = Benchmark_Larson() diff --git a/src/benchmarks/mysql.py b/src/benchmarks/mysql.py index fb9c2e7..d8a5a83 100644 --- a/src/benchmarks/mysql.py +++ b/src/benchmarks/mysql.py @@ -1,5 +1,4 @@ import copy -import matplotlib.pyplot as plt import multiprocessing import numpy as np import os @@ -8,11 +7,10 @@ import shutil import subprocess from subprocess import PIPE import sys -from time import sleep from src.globalvars import allocators from src.benchmark import Benchmark -from src.util import * +from src.util import print_status, print_debug, print_info2 cwd = os.getcwd() @@ -75,7 +73,7 @@ class Benchmark_MYSQL(Benchmark): self.start_servers() # Create sbtest TABLE - p = subprocess.run(("mysql -u root -S "+cwd+"/mysql_test/socket").split(" "), + p = subprocess.run(("mysql -u root -S " + cwd + "/mysql_test/socket").split(" "), input=b"CREATE DATABASE sbtest;\n", stdout=PIPE, stderr=PIPE) @@ -101,12 +99,12 @@ class Benchmark_MYSQL(Benchmark): shutil.rmtree("mysql_test", ignore_errors=True) def process_output(self, result, stdout, stderr, allocator, perm, verbose): - result["transactions"] = re.search("transactions:\s*(\d*)", stdout).group(1) - result["queries"] = re.search("queries:\s*(\d*)", stdout).group(1) + result["transactions"] = re.search("transactions:\\s*(\\d*)", stdout).group(1) + result["queries"] = re.search("queries:\\s*(\\d*)", stdout).group(1) # Latency - result["min"] = re.search("min:\s*(\d*.\d*)", stdout).group(1) - result["avg"] = re.search("avg:\s*(\d*.\d*)", stdout).group(1) - result["max"] = re.search("max:\s*(\d*.\d*)", stdout).group(1) + result["min"] = re.search("min:\\s*(\\d*.\\d*)", stdout).group(1) + result["avg"] = re.search("avg:\\s*(\\d*.\\d*)", stdout).group(1) + result["max"] = re.search("max:\\s*(\\d*.\\d*)", stdout).group(1) with open("/proc/"+str(self.servers[0].pid)+"/status", "r") as f: for l in f.readlines(): @@ -125,7 +123,6 @@ class Benchmark_MYSQL(Benchmark): title='"sysbench oltp read only"', filepostfix="l") - # normalized linear plot ref_alloc = list(allocators)[0] self.plot_single_arg("{transactions}", @@ -152,10 +149,10 @@ class Benchmark_MYSQL(Benchmark): # Memusage self.barplot_single_arg("{rssmax}", - xlabel='"threads"', - ylabel='"VmHWM in kB"', - title='"Memusage sysbench oltp read only"', - filepostfix="mem") + xlabel='"threads"', + ylabel='"VmHWM in kB"', + title='"Memusage sysbench oltp read only"', + filepostfix="mem") # Colored latex table showing transactions count d = {allocator: {} for allocator in allocators} @@ -203,7 +200,7 @@ class Benchmark_MYSQL(Benchmark): print(s.format(color, m), end=" ", file=f) print("\\\\", file=f) - print("\end{tabular}", file=f) + print("\\end{tabular}", file=f) self.export_to_csv("transactions") self.export_to_dataref("transactions") diff --git a/src/benchmarks/realloc.py b/src/benchmarks/realloc.py index 423bf44..7132d68 100644 --- a/src/benchmarks/realloc.py +++ b/src/benchmarks/realloc.py @@ -1,5 +1,3 @@ -import matplotlib.pyplot as plt - from src.benchmark import Benchmark @@ -16,9 +14,6 @@ class Benchmark_Realloc(Benchmark): super().__init__() def summary(self): - # bar plot - allocators = self.results["allocators"] - self.barplot_single_arg("{task-clock}", ylabel='"task-clock in ms"', title='"realloc micro benchmark"') |
