diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2020-05-30 12:48:27 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2020-06-02 11:18:47 +0200 |
| commit | 50c66a1a4f40f069fb3706602025f53952c5cc33 (patch) | |
| tree | 59042e8fdc18a67523662d00e4569386ceccf010 /summarize.py | |
| parent | 1702f1c110e59098098917e4998ee4a6df568ecb (diff) | |
| download | allocbench-50c66a1a4f40f069fb3706602025f53952c5cc33.tar.gz allocbench-50c66a1a4f40f069fb3706602025f53952c5cc33.zip | |
[benchmark.py] add function to retrieve Benchmark instance from a module
Diffstat (limited to 'summarize.py')
| -rwxr-xr-x | summarize.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/summarize.py b/summarize.py index 9a37789..95a2ae4 100755 --- a/summarize.py +++ b/summarize.py @@ -19,12 +19,12 @@ """Summarize the results of an allocbench run""" import argparse -import importlib import os import sys import allocbench.facter as facter import allocbench.globalvars +import allocbench.benchmark from allocbench.util import print_status, print_debug, print_error from allocbench.util import print_license_and_exit @@ -72,7 +72,7 @@ def bench_sum(bench, exclude_allocators=None, sets=False): new_allocs = { an: a for an, a in bench.results["allocators"].items() - if an not in exclude_allocators or {} + if an not in (exclude_allocators or {}) } bench.results["allocators"] = new_allocs @@ -127,14 +127,11 @@ def summarize(benchmarks=None, if exclude_benchmarks and benchmark in exclude_benchmarks: continue - bench_module = importlib.import_module( - f"allocbench.benchmarks.{benchmark}") - - if not hasattr(bench_module, benchmark): - print_error(f"{benchmark} has no member {benchmark}") - print_error(f"Skipping {benchmark}.") - - bench = getattr(bench_module, benchmark, sets=sets) + try: + bench = allocbench.benchmark.get_benchmark_object(benchmark) + except Exception: #pylint: disable=broad-except + print_error(f"Skipping {benchmark}. Loading failed") + continue try: bench.load() @@ -143,7 +140,7 @@ def summarize(benchmarks=None, print_status(f"Summarizing {bench.name} ...") try: - bench_sum(bench, exclude_allocators=exclude_allocators) + bench_sum(bench, exclude_allocators=exclude_allocators, sets=sets) except FileExistsError as err: print(err) |
