diff --git a/bench.py b/bench.py index f7a513ed3b15f86617bb4804e816bcfc7a068c0e..8fe78506dc8d7063e2fa2cd33ba5078eea8a270e 100755 --- a/bench.py +++ b/bench.py @@ -14,10 +14,6 @@ import src.globalvars from src.util import * -bench_dir = "src/benchmarks" -benchmarks = [e[:-3] for e in os.listdir(bench_dir) - if e[-3:] == ".py" and e != "__init__.py"] - parser = argparse.ArgumentParser(description="benchmark memory allocators") parser.add_argument("-ds, --dont-save", action='store_true', dest="dont_save", help="don't save benchmark results in RESULTDIR") @@ -141,7 +137,7 @@ def main(): # TODO load all results at once cwd = os.getcwd() - for bench in benchmarks: + for bench in src.globalvars.benchmarks: if args.benchmarks and not bench in args.benchmarks: continue @@ -170,7 +166,7 @@ def main(): old_allocs = bench.allocators # use malt as allocator - src.globalvars.allocators = {"malt": {"cmd_prefix" : malt_cmd, + bench.allocators = {"malt": {"cmd_prefix" : malt_cmd, "binary_suffix" : "", "LD_PRELOAD" : ""}} try: @@ -189,6 +185,8 @@ def main(): else: print_error("malt not found. Skipping analyse.") + if args.runs > 1: + print_status("Running", bench.name, "...") bench.run(runs=args.runs) if need_resultdir: diff --git a/src/benchmark.py b/src/benchmark.py index f904c7a887695e8d8cf1dd790282c6b4a1a549ed..4b1ae7f664c9ceca6b9c7967106a95fd964dfec3 100644 --- a/src/benchmark.py +++ b/src/benchmark.py @@ -172,7 +172,6 @@ class Benchmark (object): if runs < 1: return - print_status("Running", self.name, "...") # check if perf is allowed on this system if self.measure_cmd == self.defaults["measure_cmd"]: if Benchmark.perf_allowed == None: diff --git a/src/globalvars.py b/src/globalvars.py index c897786da01f26be73406a931976d8548e8818aa..7bf3de75cb52da7d2922fe31722165cdb335bc3d 100644 --- a/src/globalvars.py +++ b/src/globalvars.py @@ -1,3 +1,4 @@ +import inspect import os @@ -13,8 +14,19 @@ allocators = {} """File were the allocators definitions are loaded from""" allocators_file = None +"""Root directory of allocbench""" +allocbenchdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) +allocbenchdir = os.path.dirname(allocbenchdir) + """Path of the build directory""" -builddir = os.path.join(os.getcwd(), "build") +builddir = "build" """Directory were the benchmark results are stored""" resdir = None + +"""Source directory for all benchmarks""" +benchsrcdir = "src/benchmarks" + +"""List of available benchmarks""" +benchmarks = [e[:-3] for e in os.listdir(os.path.join(allocbenchdir, benchsrcdir)) + if e[-3:] == ".py" and e != "__init__.py"]