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 /bench.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 'bench.py')
| -rwxr-xr-x | bench.py | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -21,13 +21,13 @@ import argparse import atexit import datetime -import importlib import os import sys import traceback from allocbench.allocator import collect_allocators from allocbench.analyse import analyze_bench, analyze_allocators +from allocbench.benchmark import get_benchmark_object import allocbench.facter as facter import allocbench.globalvars from allocbench.util import run_cmd @@ -173,15 +173,13 @@ def main(): if args.exclude_benchmarks and bench in args.exclude_benchmarks: continue - bench_module = importlib.import_module( - f"allocbench.benchmarks.{bench}") - - # find Benchmark class - for member in bench_module.__dict__.values(): - if (not isinstance(member, type) - or member is allocbench.benchmark.Benchmark - or not issubclass(member, allocbench.benchmark.Benchmark)): - continue + try: + print_status("Loading", bench, "...") + bench = get_benchmark_object(bench) + except Exception: + print_error(traceback.format_exc()) + print_error(f"Skipping {bench}! Loading failed.") + continue try: print_status("Preparing", bench, "...") |
