diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2019-08-28 11:31:08 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2019-08-28 11:31:08 +0200 |
| commit | ae0680f8fdd4de34fc85bea869699535f7abf0b9 (patch) | |
| tree | 0c42818d1ca1dd5095a17e6213b171675fd62737 | |
| parent | 76df14113bec8b496c75e4b0d98df6fc0ff8b51f (diff) | |
| download | allocbench-ae0680f8fdd4de34fc85bea869699535f7abf0b9.tar.gz allocbench-ae0680f8fdd4de34fc85bea869699535f7abf0b9.zip | |
improve code quality and add license headers to allocator definitions
| -rw-r--r-- | src/allocators/BA_allocators.py | 19 | ||||
| -rw-r--r-- | src/allocators/__init__.py | 18 | ||||
| -rw-r--r-- | src/allocators/all.py | 20 | ||||
| -rw-r--r-- | src/allocators/bumpptr.py | 29 | ||||
| -rw-r--r-- | src/allocators/chattymalloc.py | 29 | ||||
| -rw-r--r-- | src/allocators/glibc.py | 42 | ||||
| -rw-r--r-- | src/allocators/glibcs.py | 19 | ||||
| -rw-r--r-- | src/allocators/hoard.py | 31 | ||||
| -rw-r--r-- | src/allocators/installed_allocators.py | 40 | ||||
| -rw-r--r-- | src/allocators/je_tc_super.py | 7 | ||||
| -rw-r--r-- | src/allocators/jemalloc.py | 36 | ||||
| -rw-r--r-- | src/allocators/llalloc.py | 37 | ||||
| -rw-r--r-- | src/allocators/malt.py | 23 | ||||
| -rw-r--r-- | src/allocators/mesh.py | 29 | ||||
| -rw-r--r-- | src/allocators/mimalloc.py | 37 | ||||
| -rw-r--r-- | src/allocators/no_falsesharing.py | 23 | ||||
| -rw-r--r-- | src/allocators/scalloc.py | 33 | ||||
| -rw-r--r-- | src/allocators/snmalloc.py | 37 | ||||
| -rw-r--r-- | src/allocators/supermalloc.py | 31 | ||||
| -rw-r--r-- | src/allocators/tbbmalloc.py | 35 | ||||
| -rw-r--r-- | src/allocators/tcmalloc.py | 37 |
21 files changed, 499 insertions, 113 deletions
diff --git a/src/allocators/BA_allocators.py b/src/allocators/BA_allocators.py index 5ac8870..51e4cfc 100644 --- a/src/allocators/BA_allocators.py +++ b/src/allocators/BA_allocators.py @@ -1,3 +1,22 @@ +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. If not, see <http://www.gnu.org/licenses/>. + +"""Collection containing all allocators used in Florian's BA thesis""" + from src.allocators.glibc import glibc, glibc_notc from src.allocators.tcmalloc import tcmalloc from src.allocators.jemalloc import jemalloc diff --git a/src/allocators/__init__.py b/src/allocators/__init__.py index e69de29..2700bbd 100644 --- a/src/allocators/__init__.py +++ b/src/allocators/__init__.py @@ -0,0 +1,18 @@ +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. If not, see <http://www.gnu.org/licenses/>. + +"""allocbench allocator definitions""" diff --git a/src/allocators/all.py b/src/allocators/all.py index b64ba59..6b3b46a 100644 --- a/src/allocators/all.py +++ b/src/allocators/all.py @@ -1,5 +1,21 @@ -from src.allocator import Allocator as Alloc -from src.allocator import Allocator_Sources as Alloc_Src +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. If not, see <http://www.gnu.org/licenses/>. + +"""Collection containing all available allocators""" import src.allocators.glibcs from src.allocators.tcmalloc import tcmalloc, tcmalloc_nofs diff --git a/src/allocators/bumpptr.py b/src/allocators/bumpptr.py index f95a884..98cba4b 100644 --- a/src/allocators/bumpptr.py +++ b/src/allocators/bumpptr.py @@ -1,4 +1,29 @@ +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. If not, see <http://www.gnu.org/licenses/>. + +"""Bumpptr allocator + +The bumpptr allocator makes the biggest possible tradeoff between speed and +memory in speeds favor. Memory is mmapped per thread and never freed. +See src/bumpptr.c for the actual implementation. +""" + import os -from src.allocator import Allocator, builddir +from src.allocator import Allocator, BUILDDIR -bumpptr = Allocator("bumpptr", LD_PRELOAD=os.path.join(builddir, "bumpptr_alloc.so"), color="xkcd:black") +bumpptr = Allocator("bumpptr", LD_PRELOAD=os.path.join(BUILDDIR, "bumpptr_alloc.so"), + color="xkcd:black") diff --git a/src/allocators/chattymalloc.py b/src/allocators/chattymalloc.py index 6688f51..f6618ef 100644 --- a/src/allocators/chattymalloc.py +++ b/src/allocators/chattymalloc.py @@ -1,6 +1,31 @@ +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. If not, see <http://www.gnu.org/licenses/>. + +"""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. +""" + import os -from src.allocator import Allocator, builddir +from src.allocator import Allocator, BUILDDIR chattymalloc = Allocator("chattymalloc", - LD_PRELOAD=os.path.join(builddir, "chattymalloc.so"), + LD_PRELOAD=os.path.join(BUILDDIR, "chattymalloc.so"), cmd_prefix="env CHATTYMALLOC_FILE={{result_dir}}/chatty_{{perm}}.txt") diff --git a/src/allocators/glibc.py b/src/allocators/glibc.py index b9f0a9e..c322427 100644 --- a/src/allocators/glibc.py +++ b/src/allocators/glibc.py @@ -1,19 +1,39 @@ -from src.allocator import Allocator, Allocator_Sources, library_path - - -version = 2.29 - -glibc_src = Allocator_Sources("glibc", +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. If not, see <http://www.gnu.org/licenses/>. + +"""Glibc definitions""" + +from src.allocator import Allocator, AllocatorSources, LIBRARY_PATH + +VERSION = 2.29 + +GLIBC_SRC = AllocatorSources("glibc", retrieve_cmds=["git clone git://sourceware.org/git/glibc.git"], - prepare_cmds=[f"git checkout glibc-{version}"], + prepare_cmds=[f"git checkout glibc-{VERSION}"], reset_cmds=["git reset --hard"]) -class Glibc (Allocator): - """Glibc definition for allocbench""" +class Glibc(Allocator): + """Glibc definition for allocbench + + Glibcs are loaded using their own supplied loader""" def __init__(self, name, **kwargs): - kwargs["sources"] = glibc_src + kwargs["sources"] = GLIBC_SRC configure_args = "" if "configure_args" in kwargs: @@ -26,7 +46,7 @@ class Glibc (Allocator): "cd glibc-build; make install"] kwargs["cmd_prefix"] = ("{dir}/lib/ld-linux-x86-64.so.2 --library-path {dir}/lib:" - + library_path) + + LIBRARY_PATH) # kwargs["LD_LIBRARY_PATH"] = "{dir}/lib:" + library_path diff --git a/src/allocators/glibcs.py b/src/allocators/glibcs.py index afbc88d..936d2c7 100644 --- a/src/allocators/glibcs.py +++ b/src/allocators/glibcs.py @@ -1,3 +1,22 @@ +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. If not, see <http://www.gnu.org/licenses/>. + +"""Collection containing all glibc variants""" + from src.allocators.glibc import glibc, glibc_notc, glibc_nofs, glibc_nofs_fancy diff --git a/src/allocators/hoard.py b/src/allocators/hoard.py index b50b097..cc2061a 100644 --- a/src/allocators/hoard.py +++ b/src/allocators/hoard.py @@ -1,13 +1,32 @@ -import src.allocator - - -sources = src.allocator.Allocator_Sources("Hoard", +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. + +"""Hoard allocator definition for allocbench""" + +from src.allocator import Allocator, AllocatorSources + + +sources = AllocatorSources("Hoard", retrieve_cmds=["git clone https://github.com/emeryberger/Hoard.git"], reset_cmds=["git reset --hard"]) -class Hoard (src.allocator.Allocator): - """Hoard definition for allocbench""" +class Hoard(Allocator): + """Hoard allocator""" def __init__(self, name, **kwargs): kwargs["sources"] = sources diff --git a/src/allocators/installed_allocators.py b/src/allocators/installed_allocators.py index 6844c4a..9a11d04 100644 --- a/src/allocators/installed_allocators.py +++ b/src/allocators/installed_allocators.py @@ -1,8 +1,26 @@ -"""Default allocators using system libraries""" +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. + +"""Collect allocators using installed system libraries""" import subprocess -maybe_allocators = ["tcmalloc", "jemalloc", "hoard"] +# TODO: add more allocators +MAYBE_ALLOCATORS = ["tcmalloc", "jemalloc", "hoard"] allocators = {"libc": {"cmd_prefix": "", "binary_suffix": "", @@ -10,17 +28,17 @@ allocators = {"libc": {"cmd_prefix": "", "LD_LIBRARY_PATH": "", "color": "C1"}} -for i, t in enumerate(maybe_allocators): +for i, t in enumerate(MAYBE_ALLOCATORS): try: path = subprocess.run('whereis lib{} | cut -d":" -f2'.format(t), shell=True, stdout=subprocess.PIPE, universal_newlines=True).stdout.strip() - - if path != "": - allocators[t] = {"cmd_prefix": "", - "binary_suffix": "", - "LD_PRELOAD": path, - "LD_LIBRARY_PATH": "", - "color": "C"+str(i+2)} except: - pass + continue + + if path != "": + allocators[t] = {"cmd_prefix": "", + "binary_suffix": "", + "LD_PRELOAD": path, + "LD_LIBRARY_PATH": "", + "color": "C"+str(i+2)} diff --git a/src/allocators/je_tc_super.py b/src/allocators/je_tc_super.py deleted file mode 100644 index 6245610..0000000 --- a/src/allocators/je_tc_super.py +++ /dev/null @@ -1,7 +0,0 @@ -from src.allocators.glibc import glibc -from src.allocators.tcmalloc import tcmalloc -from src.allocators.jemalloc import jemalloc -from src.allocators.supermalloc import supermalloc - - -allocators = [glibc, tcmalloc, jemalloc, supermalloc] diff --git a/src/allocators/jemalloc.py b/src/allocators/jemalloc.py index 6c37f57..4484362 100644 --- a/src/allocators/jemalloc.py +++ b/src/allocators/jemalloc.py @@ -1,15 +1,33 @@ -import src.allocator - - -version = "5.1.0" - -sources = src.allocator.Allocator_Sources("jemalloc", +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. + +"""jemalloc definition for allocbench""" + +from src.allocator import Allocator, AllocatorSources + +VERSION = "5.1.0" + +sources = AllocatorSources("jemalloc", retrieve_cmds=["git clone https://github.com/jemalloc/jemalloc.git"], - prepare_cmds=["git checkout {}".format(version), "./autogen.sh"]) + prepare_cmds=[f"git checkout {VERSION}", "./autogen.sh"]) -class Jemalloc (src.allocator.Allocator): - """jemalloc definition for allocbench""" +class Jemalloc(Allocator): + """jemalloc allocator""" def __init__(self, name, **kwargs): kwargs["sources"] = sources diff --git a/src/allocators/llalloc.py b/src/allocators/llalloc.py index 84d4926..b0da505 100644 --- a/src/allocators/llalloc.py +++ b/src/allocators/llalloc.py @@ -1,25 +1,44 @@ -from src.allocator import Allocator, Allocator_Sources, library_path - - -source = Allocator_Sources("lockless_allocator", +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. + +"""Lockless allocator definition for allocbench""" + +from src.allocator import Allocator, AllocatorSources + + +LLALLOC_SOURCE = AllocatorSources("lockless_allocator", retrieve_cmds=["wget https://locklessinc.com/downloads/lockless_allocator_src.tgz", "tar xf lockless_allocator_src.tgz"], prepare_cmds=[], reset_cmds=[]) -class Lockless_Allocator (Allocator): - """Lockless allocator definition for allocbench""" +class LocklessAllocator(Allocator): + """Lockless allocator""" def __init__(self, name, **kwargs): - kwargs["sources"] = source + kwargs["sources"] = LLALLOC_SOURCE kwargs["build_cmds"] = ["cd {srcdir}; make", "mkdir -p {dir}"] - + kwargs["LD_PRELOAD"] = "{srcdir}/libllalloc.so.1.3" super().__init__(name, **kwargs) -llalloc = Lockless_Allocator("llalloc", color="purple") +llalloc = LocklessAllocator("llalloc", color="purple") diff --git a/src/allocators/malt.py b/src/allocators/malt.py index f10efd7..599e8ff 100644 --- a/src/allocators/malt.py +++ b/src/allocators/malt.py @@ -1,3 +1,26 @@ +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. + +"""malt allocator definition + +Malt is a malloc tracker and used to capture and analyse the allocation profile +of a program. See https://github.com/memtt/malt for more details +""" + from src.allocator import Allocator # result_dir and perm are substituted during Benchmark.run diff --git a/src/allocators/mesh.py b/src/allocators/mesh.py index 604f743..f8b7c16 100644 --- a/src/allocators/mesh.py +++ b/src/allocators/mesh.py @@ -1,6 +1,25 @@ -import src.allocator - -sources = src.allocator.Allocator_Sources("Mesh", +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. + +"""Mesh definition for allocbench""" + +from src.allocator import Allocator, AllocatorSources + +sources = AllocatorSources("Mesh", retrieve_cmds=["git clone https://github.com/plasma-umass/Mesh"], reset_cmds=["git reset --hard"]) @@ -9,8 +28,8 @@ sources = src.allocator.Allocator_Sources("Mesh", # "adsf0982345") -class Mesh (src.allocator.Allocator): - """Mesh definition for allocbench""" +class Mesh(Allocator): + """Mesh allocator""" def __init__(self, name, **kwargs): kwargs["sources"] = sources diff --git a/src/allocators/mimalloc.py b/src/allocators/mimalloc.py index 24338e3..2f84fe1 100644 --- a/src/allocators/mimalloc.py +++ b/src/allocators/mimalloc.py @@ -1,18 +1,37 @@ -import src.allocator - -version = "master" - -mimalloc_src = src.allocator.Allocator_Sources("mimalloc", +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. + +"""mimalloc definition for allocbench""" + +from src.allocator import Allocator, AllocatorSources + +VERSION = "master" + +MIMALLOC_SRC = AllocatorSources("mimalloc", ["git clone https://github.com/microsoft/mimalloc"], - ["git checkout ".format(version)], + [f"git checkout {VERSION}"], ["git reset --hard"]) -class Mimalloc (src.allocator.Allocator): - """mimalloc definition for allocbench""" +class Mimalloc(Allocator): + """mimalloc allocator""" def __init__(self, name, **kwargs): - kwargs["sources"] = mimalloc_src + kwargs["sources"] = MIMALLOC_SRC kwargs["LD_PRELOAD"] = "{dir}/libmimalloc.so" kwargs["build_cmds"] = ["mkdir -p {dir}", "cd {dir}; cmake {srcdir}", diff --git a/src/allocators/no_falsesharing.py b/src/allocators/no_falsesharing.py index 2514b7c..23726c4 100644 --- a/src/allocators/no_falsesharing.py +++ b/src/allocators/no_falsesharing.py @@ -1,5 +1,24 @@ +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. + +"""Collection containing all no falsesahring patches""" + from src.allocators.tcmalloc import tcmalloc, tcmalloc_nofs -from src.allocators.glibc import glibc, glibc_nofs +from src.allocators.glibc import glibc, glibc_nofs, glibc_nofs_fancy -allocators = [glibc, glibc_nofs, tcmalloc, tcmalloc_nofs] +allocators = [glibc, glibc_nofs, glibc_nofs_fancy, tcmalloc, tcmalloc_nofs] diff --git a/src/allocators/scalloc.py b/src/allocators/scalloc.py index 9114b31..0b3d3cf 100644 --- a/src/allocators/scalloc.py +++ b/src/allocators/scalloc.py @@ -1,22 +1,41 @@ -from src.allocator import Allocator, Allocator_Sources, library_path +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. + +"""Scalloc definition for allocbench""" + +from src.allocator import Allocator, AllocatorSources from src.util import print_error -version = "v1.0.0" +VERSION = "v1.0.0" -scalloc_src = Allocator_Sources("scalloc", +SCALLOC_SRC = AllocatorSources("scalloc", retrieve_cmds=["git clone https://github.com/cksystemsgroup/scalloc"], - prepare_cmds=["git checkout {}".format(version), + prepare_cmds=[f"git checkout {VERSION}", "cd {srcdir}; tools/make_deps.sh", "cd {srcdir}; build/gyp/gyp --depth=. scalloc.gyp"], reset_cmds=["git reset --hard"]) -class Scalloc (Allocator): - """Scalloc definition for allocbench""" +class Scalloc(Allocator): + """Scalloc allocator""" def __init__(self, name, **kwargs): - kwargs["sources"] = scalloc_src + kwargs["sources"] = SCALLOC_SRC kwargs["build_cmds"] = ["cd {srcdir}; BUILDTYPE=Release make", "mkdir -p {dir}"] diff --git a/src/allocators/snmalloc.py b/src/allocators/snmalloc.py index 0cc4dc7..0496196 100644 --- a/src/allocators/snmalloc.py +++ b/src/allocators/snmalloc.py @@ -1,18 +1,37 @@ -import src.allocator - -version = "master" - -snmalloc_src = src.allocator.Allocator_Sources("snmalloc", +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. + +"""Snmalloc definition for allocbench""" + +from src.allocator import Allocator, AllocatorSources + +VERSION = "master" + +SNMALLOC_SRC = AllocatorSources("snmalloc", ["git clone https://github.com/microsoft/snmalloc"], - ["git checkout ".format(version)], + [f"git checkout {VERSION}"], ["git reset --hard"]) -class Snmalloc (src.allocator.Allocator): - """snmalloc definition for allocbench""" +class Snmalloc(Allocator): + """snmalloc allocator""" def __init__(self, name, **kwargs): - kwargs["sources"] = snmalloc_src + kwargs["sources"] = SNMALLOC_SRC kwargs["LD_PRELOAD"] = "{dir}/libsnmallocshim.so" kwargs["build_cmds"] = ["mkdir -p {dir}", "cd {dir}; cmake -G Ninja {srcdir} -DCMAKE_BUILD_TYPE=Release", diff --git a/src/allocators/supermalloc.py b/src/allocators/supermalloc.py index b425303..0c4040b 100644 --- a/src/allocators/supermalloc.py +++ b/src/allocators/supermalloc.py @@ -1,14 +1,35 @@ +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. + +"""SuperMalloc definition for allocbench""" + +from src.allocator import Allocator, AllocatorSources + import src.allocator -version = "709663fb81ba091b0a78058869a644a272f4163d" +VERSION = "709663fb81ba091b0a78058869a644a272f4163d" -sources = src.allocator.Allocator_Sources("SuperMalloc", +sources = AllocatorSources("SuperMalloc", retrieve_cmds=["git clone https://github.com/kuszmaul/SuperMalloc"], - prepare_cmds=["git checkout {}".format(version)]) + prepare_cmds=[f"git checkout {VERSION}"]) -class SuperMalloc (src.allocator.Allocator): - """SuperMalloc definition for allocbench""" +class SuperMalloc(Allocator): + """SuperMalloc allocator""" def __init__(self, name, **kwargs): kwargs["sources"] = sources diff --git a/src/allocators/tbbmalloc.py b/src/allocators/tbbmalloc.py index d96f40b..aa50253 100644 --- a/src/allocators/tbbmalloc.py +++ b/src/allocators/tbbmalloc.py @@ -1,15 +1,34 @@ -import src.allocator - -version = "2019_U8" - -source = src.allocator.Allocator_Sources("tbb", +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. + +"""tbbmalloc definition for allocbench""" + +from src.allocator import Allocator, AllocatorSources + +VERSION = "2019_U8" + +source = AllocatorSources("tbb", ["git clone https://github.com/intel/tbb.git"], - ["git checkout {}".format(version)], + [f"git checkout {VERSION}"], ["git reset --hard"]) -class TBBMalloc (src.allocator.Allocator): - """TCMalloc definition for allocbench""" +class TBBMalloc(Allocator): + """tbbmalloc allocator""" def __init__(self, name, **kwargs): kwargs["sources"] = source diff --git a/src/allocators/tcmalloc.py b/src/allocators/tcmalloc.py index 9372f00..916da88 100644 --- a/src/allocators/tcmalloc.py +++ b/src/allocators/tcmalloc.py @@ -1,18 +1,37 @@ -import src.allocator - -version = 2.7 - -tcmalloc_src = src.allocator.Allocator_Sources("tcmalloc", +# Copyright 2018-2019 Florian Fischer <florian.fl.fischer@fau.de> +# +# This file is part of allocbench. +# +# allocbench is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# allocbench is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with allocbench. + +"""TCMalloc definition for allocbench""" + +from src.allocator import Allocator, AllocatorSources + +VERSION = 2.7 + +TCMALLOC_SRC = AllocatorSources("tcmalloc", ["git clone https://github.com/gperftools/gperftools.git tcmalloc"], - ["git checkout gperftools-{}".format(version), "./autogen.sh"], + [f"git checkout gperftools-{VERSION}", "./autogen.sh"], ["git reset --hard"]) -class TCMalloc (src.allocator.Allocator): - """TCMalloc definition for allocbench""" +class TCMalloc(Allocator): + """TCMalloc allocator""" def __init__(self, name, **kwargs): - kwargs["sources"] = tcmalloc_src + kwargs["sources"] = TCMALLOC_SRC kwargs["LD_PRELOAD"] = "{dir}/lib/libtcmalloc.so" kwargs["build_cmds"] = ["cd {srcdir}; ./configure --prefix={dir}", "cd {srcdir}; make install -j4"] |
