From f20c5285a0c0351a4cb8ac68a994a8d69457963e Mon Sep 17 00:00:00 2001
From: Florian Fischer <florian.fl.fischer@fau.de>
Date: Mon, 24 Jun 2019 17:21:09 +0200
Subject: [PATCH] add mesh and lockless_allocator definitions

---
 src/allocators/all.py         |  3 ++-
 src/allocators/llalloc.py     | 25 +++++++++++++++++++++++++
 src/allocators/mesh.py        | 22 ++++++++++++++++++++++
 src/allocators/supermalloc.py |  2 +-
 4 files changed, 50 insertions(+), 2 deletions(-)
 create mode 100644 src/allocators/llalloc.py
 create mode 100644 src/allocators/mesh.py

diff --git a/src/allocators/all.py b/src/allocators/all.py
index bf2babd..f68863d 100644
--- a/src/allocators/all.py
+++ b/src/allocators/all.py
@@ -6,6 +6,7 @@ from src.allocators.tcmalloc import tcmalloc, tcmalloc_nofs
 from src.allocators.jemalloc import jemalloc
 from src.allocators.hoard import hoard
 from src.allocators.supermalloc import supermalloc
+from src.allocators.llalloc import llalloc
 
 
 mesh = Alloc("Mesh", sources=Alloc_Src("Mesh",
@@ -18,4 +19,4 @@ mesh = Alloc("Mesh", sources=Alloc_Src("Mesh",
                                         "mkdir {dir}"])
 
 allocators = [*src.allocators.glibcs.allocators, tcmalloc, tcmalloc_nofs,
-              jemalloc, hoard, mesh, supermalloc]
+              jemalloc, hoard, mesh, supermalloc, llalloc]
diff --git a/src/allocators/llalloc.py b/src/allocators/llalloc.py
new file mode 100644
index 0000000..073899c
--- /dev/null
+++ b/src/allocators/llalloc.py
@@ -0,0 +1,25 @@
+from src.allocator import Allocator, Allocator_Sources, library_path
+
+
+source = Allocator_Sources("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"""
+    def __init__(self, name, **kwargs):
+
+        kwargs["sources"] = 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")
+
diff --git a/src/allocators/mesh.py b/src/allocators/mesh.py
new file mode 100644
index 0000000..843685b
--- /dev/null
+++ b/src/allocators/mesh.py
@@ -0,0 +1,22 @@
+import src.allocator
+
+sources = src.allocator.Allocator_Sources("Mesh",
+            retrieve_cmds=["git clone https://github.com/plasma-umass/Mesh"],
+            reset_cmds=["git stash"])
+
+
+class Mesh (src.allocator.Allocator):
+    """Mesh definition for allocbench"""
+    def __init__(self, name, **kwargs):
+
+        kwargs["sources"] = sources
+        kwargs["LD_PRELOAD"] = "{srcdir}/libmesh.so"
+        kwargs["build_cmds"] = ["cd {srcdir}; git submodule update --init",
+                                "cd {srcdir}; ./configure",
+                                "cd {srcdir}; make -j 4",
+                                "mkdir -p {dir}"]
+
+        super().__init__(name, **kwargs)
+
+
+mesh = Mesh("Mesh")
diff --git a/src/allocators/supermalloc.py b/src/allocators/supermalloc.py
index 24fbb15..a8b5789 100644
--- a/src/allocators/supermalloc.py
+++ b/src/allocators/supermalloc.py
@@ -19,4 +19,4 @@ class SuperMalloc (src.allocator.Allocator):
         super().__init__(name, **kwargs)
 
 
-supermalloc = SuperMalloc("SuperMalloc", color="C1")
+supermalloc = SuperMalloc("SuperMalloc")
-- 
GitLab