From 4dc95d03d37d1093bb7800a0b62a1d7fed4e35a7 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 19 Jul 2020 17:07:18 +0200 Subject: [allocator] add new "system_default" allocator using an empty AllocatorDict --- allocbench/allocator.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/allocbench/allocator.py b/allocbench/allocator.py index f66a607..db5f988 100644 --- a/allocbench/allocator.py +++ b/allocbench/allocator.py @@ -191,20 +191,23 @@ class Allocator: return res_dict +def create_empty_allocator_dict() -> AllocatorDict: + """Return an empty allocator dict""" + return { + "cmd_prefix": "", + "binary_suffix": "", + "LD_PRELOAD": "", + "LD_LIBRARY_PATH": "", + "color": None + } + + def collect_installed_allocators() -> AllocatorCollection: """Collect allocators using installed system libraries""" maybe_allocators = list(collect_available_allocators().keys()) - allocators = { - "libc": { - "cmd_prefix": "", - "binary_suffix": "", - "LD_PRELOAD": "", - "LD_LIBRARY_PATH": "", - "color": None - } - } + allocators = {"system_default": create_empty_allocator_dict()} for alloc in maybe_allocators: try: @@ -295,6 +298,8 @@ def collect_allocators( alloc_name: alloc.build() for alloc_name, alloc in available_allocators.items() } + if name == "system_default": + return {"system_default": create_empty_allocator_dict()} # file exists -> interpret as python file with a global variable allocators if os.path.isfile(name): -- cgit v1.2.3