aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2020-07-11 21:09:59 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2020-07-11 21:09:59 +0200
commit3bf39c214f62a43aa8b0e72112d65f079509f08a (patch)
tree0a8e6973654ffc302916f64362f9e778119d5ddc
parentbdd47a691e5780a5b69d373382b343194fa123d9 (diff)
downloadallocbench-3bf39c214f62a43aa8b0e72112d65f079509f08a.tar.gz
allocbench-3bf39c214f62a43aa8b0e72112d65f079509f08a.zip
[globalvars] remove list of available benchmarks from globalvars.BENCHMARK to benchmark.AVAIL_BENCHMARKS
-rw-r--r--allocbench/benchmark.py5
-rw-r--r--allocbench/globalvars.py5
-rwxr-xr-xbench.py4
-rwxr-xr-xscripts/print_facts.py8
-rwxr-xr-xsummarize.py2
5 files changed, 11 insertions, 13 deletions
diff --git a/allocbench/benchmark.py b/allocbench/benchmark.py
index e886ac5..70be8f7 100644
--- a/allocbench/benchmark.py
+++ b/allocbench/benchmark.py
@@ -43,6 +43,11 @@ from allocbench.util import print_status, print_error, print_warn
from allocbench.util import print_info0, print_info, print_debug
from allocbench.util import find_cmd, prefix_cmd_with_abspath, run_cmd
+AVAIL_BENCHMARKS = [
+ p.stem for p in get_allocbench_benchmark_src_dir().glob('*.py')
+ if p.name != "__init__.py"
+]
+
class Benchmark:
"""Default implementation of most methods allocbench expects from a benchmark"""
diff --git a/allocbench/globalvars.py b/allocbench/globalvars.py
index 7a84a40..f282b03 100644
--- a/allocbench/globalvars.py
+++ b/allocbench/globalvars.py
@@ -27,11 +27,6 @@ VERBOSITY = 0
ALLOCATORS = {}
-BENCHMARKS = [
- e[:-3] for e in os.listdir(os.path.join(ALLOCBENCHDIR, BENCHSRCDIR))
- if e[-3:] == ".py" and e != "__init__.py"
-]
-
SUMMARY_FILE_EXT = "svg"
LATEX_CUSTOM_PREAMBLE = ""
diff --git a/bench.py b/bench.py
index 8d786d5..925159b 100755
--- a/bench.py
+++ b/bench.py
@@ -165,11 +165,11 @@ def main():
# warn about unknown benchmarks
for bench in (args.benchmarks or []) + (args.exclude_benchmarks or []):
- if bench not in allocbench.globalvars.BENCHMARKS:
+ if bench not in allocbench.benchmark.AVAIL_BENCHMARKS:
print_error(f'Benchmark "{bench}" unknown!')
# Run actual benchmarks
- for bench in allocbench.globalvars.BENCHMARKS:
+ for bench in allocbench.benchmark.AVAIL_BENCHMARKS:
if args.benchmarks and bench not in args.benchmarks:
continue
diff --git a/scripts/print_facts.py b/scripts/print_facts.py
index ec9404c..6099b6f 100755
--- a/scripts/print_facts.py
+++ b/scripts/print_facts.py
@@ -20,17 +20,15 @@
import argparse
import importlib
-import inspect
import os
import sys
-CURRENTDIR = os.path.dirname(
- os.path.abspath(inspect.getfile(inspect.currentframe())))
+CURRENTDIR = os.path.dirname(os.path.abspath(__file__))
PARENTDIR = os.path.dirname(CURRENTDIR)
sys.path.insert(0, PARENTDIR)
+from allocbench.benchmark import AVAIL_BENCHMARKS
import allocbench.facter as facter
-from allocbench.globalvars import BENCHMARKS
from allocbench.plots import print_facts, print_common_facts
from allocbench.util import print_error
@@ -49,7 +47,7 @@ def main():
cwd = os.getcwd()
os.chdir(args.results)
- for benchmark in BENCHMARKS:
+ for benchmark in AVAIL_BENCHMARKS:
bench_module = importlib.import_module(
f"allocbench.benchmarks.{benchmark}")
diff --git a/summarize.py b/summarize.py
index 95a2ae4..b91723e 100755
--- a/summarize.py
+++ b/summarize.py
@@ -121,7 +121,7 @@ def summarize(benchmarks=None,
cwd = os.getcwd()
os.chdir(allocbench.globalvars.resdir)
- for benchmark in allocbench.globalvars.BENCHMARKS:
+ for benchmark in allocbench.benchmark.AVAIL_BENCHMARKS:
if benchmarks and not benchmark in benchmarks:
continue
if exclude_benchmarks and benchmark in exclude_benchmarks: