From 3d676dfc064189f906c8afe70f90dde9494baada Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 22 Jan 2019 15:09:57 +0100 Subject: add load path option and don't fail if result directories exists already --- bench.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'bench.py') diff --git a/bench.py b/bench.py index 7a3b0f9..608aed9 100755 --- a/bench.py +++ b/bench.py @@ -11,7 +11,7 @@ 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 disk", action='store_true') +parser.add_argument("-l", "--load", help="load benchmark results from directory", 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='+') @@ -36,14 +36,17 @@ def main(): else: resdir = os.path.join("results", src.facter.get_hostname(), datetime.datetime.now().strftime("%Y-%m-%dT%H:%M")) - os.makedirs(resdir) + try: + os.makedirs(resdir) + except FileExistsError: + pass for bench in benchmarks: bench = eval("importlib.import_module('src.{0}').{0}".format(bench)) if args.benchmarks and not bench.name in args.benchmarks: continue if args.load: - bench.load() + bench.load(path=args.load) if args.runs > 0 or args.analyse: print("Preparing", bench.name, "...") @@ -67,7 +70,10 @@ def main(): bench.save() if not args.nosum and not (args.runs < 1 and not args.load): - os.mkdir(bench.name) + try: + os.mkdir(bench.name) + except FileExistsError: + pass os.chdir(bench.name) print("Summarizing", bench.name, "...") bench.summary() -- cgit v1.2.3