From 0d192f8cf3c21b2382e227fab057dabe16ea5e8b Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 17 Jun 2019 14:54:26 +0200 Subject: reduce code duplication by giving each known allocator its own class also move allocator related code to src/allocators --- src/allocators/tcmalloc.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/allocators/tcmalloc.py (limited to 'src/allocators/tcmalloc.py') diff --git a/src/allocators/tcmalloc.py b/src/allocators/tcmalloc.py new file mode 100644 index 0000000..1eb0db4 --- /dev/null +++ b/src/allocators/tcmalloc.py @@ -0,0 +1,20 @@ +import src.allocator + + +version = 2.7 + +tcmalloc_src = src.allocator.Allocator_Sources("tcmalloc", + ["git clone https://github.com/gperftools/gperftools.git"], + ["git checkout gperftools-{}".format(version), "./autogen.sh"], + ["git stash"]) + +class TCMalloc (src.allocator.Allocator): + """TCMalloc definition for allocbench""" + def __init__(self, name, **kwargs): + + kwargs["sources"] = tcmalloc_src + kwargs["LD_PRELOAD"] = "{dir}/lib/libtcmalloc.so" + kwargs["build_cmds"] = ["cd {srcdir}; ./configure --prefix={dir} CXXFLAGS=-O2", + "cd {srcdir}; make install -j4"] + + super().__init__(name, **kwargs) -- cgit v1.2.3