diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2019-08-28 17:38:51 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2019-08-28 17:38:51 +0200 |
| commit | 9983ff0bd87663c95328a8bb098828c2a84fcc7b (patch) | |
| tree | a0fd52af736d0d701a98a891ddcdef8f4fb17337 | |
| parent | dcd05b6ebb31495d4a80d7979dc1cc339668efdc (diff) | |
| download | allocbench-9983ff0bd87663c95328a8bb098828c2a84fcc7b.tar.gz allocbench-9983ff0bd87663c95328a8bb098828c2a84fcc7b.zip | |
make all default allocator target
| -rwxr-xr-x | bench.py | 3 | ||||
| -rw-r--r-- | src/allocator.py | 49 |
2 files changed, 26 insertions, 26 deletions
@@ -79,7 +79,8 @@ def main(): parser.add_argument("-v", "--verbose", help="more output", action='count') parser.add_argument("-b", "--benchmarks", help="benchmarks to run", nargs='+') parser.add_argument("-xb", "--exclude-benchmarks", help="explicitly excluded benchmarks", nargs='+') - parser.add_argument("-a", "--allocators", help="allocators to test", type=str, nargs='+') + parser.add_argument("-a", "--allocators", help="allocators to test", type=str, nargs='+', + default=["all"]) parser.add_argument("-rd", "--resultdir", help="directory where all results go", type=str) parser.add_argument("--license", help="print license info and exit", action='store_true') diff --git a/src/allocator.py b/src/allocator.py index 0ffa56e..4243609 100644 --- a/src/allocator.py +++ b/src/allocator.py @@ -239,28 +239,27 @@ def collect_allocators(allocators): if allocators is None and os.path.isfile(default_allocators_file): return read_allocators_collection_file(default_allocators_file) - if allocators is not None: - ret = {} - for name in allocators: - # file exists -> interpret as python file with a global variable allocators - if os.path.isfile(name): - print_status("Sourcing allocators definitions at", name, "...") - ret.update(read_allocators_collection_file(name)) - - # file is one of our allocator definitions import it - elif os.path.isfile("src/allocators/" + name + ".py"): - module = importlib.import_module('src.allocators.' + name) - # name is collection - if hasattr(module, "allocators"): - for alloc in module.allocators: - ret[alloc.name] = alloc.build() - # name is single allocator - elif issubclass(getattr(module, name).__class__, src.allocator.Allocator): - ret[name] = getattr(module, name).build() - else: - print_error(name, "is neither a python file or a known allocator definition.") - return ret - - print_status("Using system-wide installed allocators ...") - importlib.import_module('src.allocators.installed_allocators') - return src.allocators.installed_allocators.allocators + ret = {} + for name in allocators: + if name == "installed": + print_status("Using system-wide installed allocators ...") + importlib.import_module('src.allocators.installed_allocators') + ret.update(src.allocators.installed_allocators.allocators) + # file exists -> interpret as python file with a global variable allocators + elif os.path.isfile(name): + print_status("Sourcing allocators definitions at", name, "...") + ret.update(read_allocators_collection_file(name)) + + # file is one of our allocator definitions import it + elif os.path.isfile("src/allocators/" + name + ".py"): + module = importlib.import_module('src.allocators.' + name) + # name is collection + if hasattr(module, "allocators"): + for alloc in module.allocators: + ret[alloc.name] = alloc.build() + # name is single allocator + elif issubclass(getattr(module, name).__class__, src.allocator.Allocator): + ret[name] = getattr(module, name).build() + else: + print_error(name, "is neither a python file or a known allocator definition.") + return ret |
