aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2018-07-23 18:15:50 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2018-07-23 18:15:50 +0200
commit675bd9abd3e8228a936d1bcb8030912502b81c44 (patch)
tree9a720501d6ccbec2b7cdecf94e2858e6f151343a
parente479948088852258c8f1a028e62963368a4f4c5e (diff)
downloadallocbench-675bd9abd3e8228a936d1bcb8030912502b81c44.tar.gz
allocbench-675bd9abd3e8228a936d1bcb8030912502b81c44.zip
remove conprod from benchmark list add memory footprint to mysql
also rename the benchmarks
-rwxr-xr-xbench.py11
-rw-r--r--loop.py (renamed from bench_loop.py)7
-rw-r--r--mysql.py (renamed from bench_mysql.py)33
3 files changed, 34 insertions, 17 deletions
diff --git a/bench.py b/bench.py
index 36ea5ec..c7d70f7 100755
--- a/bench.py
+++ b/bench.py
@@ -2,24 +2,27 @@
import argparse
-from bench_loop import loop
-from bench_conprod import conprod
-from bench_mysql import mysql
+from loop import loop
+# from bench_conprod import conprod
+from mysql import mysql
parser = argparse.ArgumentParser(description="benchmark memory allocators")
parser.add_argument("-s", "--save", help="save benchmark results to disk", action='store_true')
parser.add_argument("-l", "--load", help="load benchmark results from disk", action='store_true')
parser.add_argument("-r", "--runs", help="how often the benchmarks run", default=3, type=int)
parser.add_argument("-v", "--verbose", help="more output", action='store_true')
+parser.add_argument("-b", "--benchmarks", help="benchmarks to run", nargs='+')
-benchmarks = [loop, conprod, mysql]
+benchmarks = [loop, mysql]
def main():
args = parser.parse_args()
print (args)
for bench in benchmarks:
+ if args.benchmarks and not bench.name in args.benchmarks:
+ continue
if args.load:
bench.load()
diff --git a/bench_loop.py b/loop.py
index 6caedb8..a70bd92 100644
--- a/bench_loop.py
+++ b/loop.py
@@ -15,8 +15,7 @@ cmd = ("perf stat -x\; -e cpu-clock:k,cache-references,cache-misses,cycles,"
class Benchmark_Loop( Benchmark ):
def __init__(self):
- self.file_name = "bench_loop"
- self.name = "Loop Stress Benchmark"
+ self.name = "loop"
self.descrition = """This benchmark makes n allocations in t concurrent threads.
How allocations are freed can be changed with the benchmark
version""",
@@ -127,7 +126,7 @@ class Benchmark_Loop( Benchmark ):
plt.xlabel("threads")
plt.ylabel("MOPS/s")
plt.title("Loop: " + str(size) + "B")
- plt.savefig(self.file_name + "." + str(size) + "B.png")
+ plt.savefig(self.name + "." + str(size) + "B.png")
plt.clf()
# NTHREADS fixed
@@ -150,7 +149,7 @@ class Benchmark_Loop( Benchmark ):
plt.xlabel("size in B")
plt.ylabel("MOPS/s")
plt.title("Loop: " + str(n) + "thread(s)")
- plt.savefig(self.file_name + "." + str(n) + "threads.png")
+ plt.savefig(self.name + "." + str(n) + "threads.png")
plt.clf()
loop = Benchmark_Loop()
diff --git a/bench_mysql.py b/mysql.py
index 1e5c674..22c9f0d 100644
--- a/bench_mysql.py
+++ b/mysql.py
@@ -27,8 +27,7 @@ server_cmd = ("mysqld -h {0}/mysql_test --socket={0}/mysql_test/socket "
class Benchmark_MYSQL( Benchmark ):
def __init__(self):
- self.file_name = "bench_mysql"
- self.name = "MYSQL Stress Benchmark"
+ self.name = "mysql"
self.descrition = """See sysbench documentation."""
self.targets = copy.copy(common_targets)
del(self.targets["klmalloc"])
@@ -120,6 +119,13 @@ class Benchmark_MYSQL( Benchmark ):
print("Aborting Benchmark.")
return False
+ # Get initial memory footprint
+ ps = subprocess.run(["ps", "-F", str(self.server.pid)], stdout=subprocess.PIPE)
+ tokens = str(ps.stdout.splitlines()[1]).split()
+ if not tname in self.results["memusage"]:
+ self.results["memusage"] = []
+ self.results["memusage"].append({"VSZ_start" : tokens[4], "RSS_start" : tokens[5]})
+
for i, thread in enumerate(self.nthreads):
print(tname + ":", i + 1, "of", n, "\r", end='')
@@ -152,13 +158,10 @@ class Benchmark_MYSQL( Benchmark ):
print()
- # Get memory stats from server
- if "memusage" not in self.results:
- self.results["memusage"] = {}
-
+ # Get final memory footprint
ps = subprocess.run(["ps", "-F", str(self.server.pid)], stdout=subprocess.PIPE)
tokens = str(ps.stdout.splitlines()[1]).split()
- self.results["memusage"][tname] = {"VSZ" : tokens[4], "RSS" : tokens[5]}
+ self.results["memusage"][tname][run].update({"VSZ_end" : tokens[4], "RSS_end" : tokens[5]})
self.server.kill()
self.server.wait()
@@ -188,7 +191,7 @@ class Benchmark_MYSQL( Benchmark ):
plt.xlabel("threads")
plt.ylabel("transactions")
plt.title("sysbench oltp read only")
- plt.savefig(self.file_name + ".l.ro.png")
+ plt.savefig(self.name + ".l.ro.png")
plt.clf()
# bar plot
@@ -211,7 +214,19 @@ class Benchmark_MYSQL( Benchmark ):
plt.xticks(range(1, len(nthreads) + 1), nthreads)
plt.ylabel("transactions")
plt.title("sysbench oltp read only")
- plt.savefig(self.file_name + ".b.ro.png")
+ plt.savefig(self.name + ".b.ro.png")
plt.clf()
+ # memusage
+ for target, measures in self.results["memusage"].items():
+ vsz_growth = []
+ rss_growth = []
+ for m in measures:
+ vsz_growth.append(m["VSZ_start"] - m["VSZ_end"])
+ rss_growth.append(m["RSS_start"] - m["RSS_end"])
+ print(target, "memory footprint:")
+ print("\t avg vsz growth:", np.mean(vsz_growth))
+ print("\t avg rss growth:", np.mean(rss_growth))
+
+
mysql = Benchmark_MYSQL()