From cddfdeddcc97872f928d8d1cbdcbc13e7f07c99f Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 22 Jan 2019 19:18:33 +0100 Subject: add custom target option the custom target definitions must be a valid python script exporting a global dictionary "targets". --- bench.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'bench.py') 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 ") 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) -- cgit v1.2.3