aboutsummaryrefslogtreecommitdiff
path: root/src/allocators/tcmalloc.py
blob: 9372f00a825af2643a066becff3c1b385bf4ca73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import src.allocator

version = 2.7

tcmalloc_src = src.allocator.Allocator_Sources("tcmalloc",
                         ["git clone https://github.com/gperftools/gperftools.git tcmalloc"],
                         ["git checkout gperftools-{}".format(version), "./autogen.sh"],
                         ["git reset --hard"])


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}",
                                "cd {srcdir}; make install -j4"]

        super().__init__(name, **kwargs)


tcmalloc = TCMalloc("TCMalloc", color="xkcd:blue")

tcmalloc_nofs = TCMalloc("TCMalloc-NoFalsesharing",
                         patches=["{patchdir}/tcmalloc_2.7_no_active_falsesharing.patch"],
                         color="xkcd:navy")