aboutsummaryrefslogtreecommitdiff
path: root/bench.py
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2019-01-22 19:18:33 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2019-01-22 19:18:33 +0100
commitcddfdeddcc97872f928d8d1cbdcbc13e7f07c99f (patch)
treeb3418f755d29a34bab4ebd212ec53e2a9f7151b6 /bench.py
parentd236f892cc82f69b298c260913725ddfa4bea980 (diff)
downloadallocbench-cddfdeddcc97872f928d8d1cbdcbc13e7f07c99f.tar.gz
allocbench-cddfdeddcc97872f928d8d1cbdcbc13e7f07c99f.zip
add custom target option
the custom target definitions must be a valid python script exporting a global dictionary "targets".
Diffstat (limited to 'bench.py')
-rwxr-xr-xbench.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/bench.py b/bench.py
index 608aed9..2adb0cc 100755
--- a/bench.py
+++ b/bench.py
@@ -6,12 +6,14 @@ import importlib
import os
import src.facter
+import src.targets
benchmarks = ["loop", "mysql", "falsesharing", "dj_trace", "larson"]
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 directory", type=str)
+parser.add_argument("-t", "--targets", help="load target definitions from file", type=str)
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='+')
@@ -27,9 +29,18 @@ def main():
print("Copyright (C) 2018-1029 Florian Fischer")
print("License GPLv3: GNU GPL version 3 <http://gnu.org/licenses/gpl.html>")
return
+
if args.verbose:
print(args)
+ if args.targets:
+ with open(args.targets, "r") as f:
+ g = {}
+ exec(f.read(), g)
+ src.targets.targets = g["targets"]
+ if args.verbose:
+ print("Targets:", src.targets.targets.keys())
+
if args.save or not args.nosum and not (args.runs < 1 and not args.load):
if args.resultdir:
resdir = os.path.join(args.resultdir)