From 879e8cd0130754b0f0bf50eeeca18859095bd581 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 5 May 2020 14:34:39 +0200 Subject: chattymalloc: use external chattymalloc repository --- src/allocators/chattymalloc.py | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'src/allocators/chattymalloc.py') diff --git a/src/allocators/chattymalloc.py b/src/allocators/chattymalloc.py index 0f893bb..ff4a3ba 100644 --- a/src/allocators/chattymalloc.py +++ b/src/allocators/chattymalloc.py @@ -1,4 +1,4 @@ -# Copyright 2018-2019 Florian Fischer +# Copyright 2018-2020 Florian Fischer # # This file is part of allocbench. # @@ -16,16 +16,37 @@ # along with allocbench. If not, see . """chattymalloc allocator -This shared library is no functional allocator. It is used to retrieve a trace -of the allocator usage of the executed programm. It overrides the malloc API -and writes each call and its result to an output file. -See src/chattymalloc.c and chattyparser.py for its implementation and usage. +This shared library is not a functional allocator. It is used to trace +the allocator usage and the executed program. It overrides the malloc API +and saves each call and its result to a memory mapped output file. """ import os -from src.allocator import Allocator, BUILDDIR -chattymalloc = Allocator( - "chattymalloc", - LD_PRELOAD=os.path.join(BUILDDIR, "chattymalloc.so"), - cmd_prefix="env CHATTYMALLOC_FILE={{result_dir}}/{{perm}}.trace") +from src.artifact import GitArtifact +from src.allocator import Allocator + +VERSION = "1a09b144eb18919014ecf86da3442344b0eaa5b2" + +class Chattymalloc(Allocator): + """Chattymalloc definition for allocbench""" + + sources = GitArtifact("chattymalloc", + "https://github.com/fischerling/chattymalloc") + + def __init__(self, name, **kwargs): + + configuration = "--buildtype=release " + for option, value in kwargs.get("options", {}).items(): + configuration += f"-D{option}={value} " + + self.build_cmds = [ + f"meson {{srcdir}} {{dir}} {configuration}", "ninja -C {dir}" + ] + + self.LD_PRELOAD = "{dir}/libchattymalloc.so" + self.cmd_prefix="env CHATTYMALLOC_FILE={{result_dir}}/{{perm}}.trace" + super().__init__(name, **kwargs) + + +chattymalloc = Chattymalloc("chattymalloc", version=VERSION) -- cgit v1.2.3