From f2327ada5590f40137416f301762cd3c11ab36b6 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 8 Feb 2019 13:31:11 +0100 Subject: s/target/allocator/ and remove analyse feature Use systemwide installed allocators by default --- src/allocators.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/allocators.py (limited to 'src/allocators.py') diff --git a/src/allocators.py b/src/allocators.py new file mode 100644 index 0000000..dbf26d1 --- /dev/null +++ b/src/allocators.py @@ -0,0 +1,22 @@ +"""Default allocators using system libraries""" + +import os +import subprocess + +maybe_allocators = ["tcmalloc", "jemalloc", "hoard"] + +allocators = {"libc": {"cmd_prefix" : "", + "binary_suffix" : "", + "LD_PRELOAD" : "", + "color" : "C1"}} + +for i, t in enumerate(maybe_allocators): + try: + path = subprocess.check_output('whereis lib{} | cut -d":" -f2'.format(t), + shell=True, text=True).strip() + + if path != "": + allocators[t] = {"cmd_prefix": "", "binary_suffix": "", + "LD_PRELOAD": path, "color": "C"+str(i+2)} + except: + pass -- cgit v1.2.3