diff options
author | Jan Huwald <jh@sotun.de> | 2013-06-07 13:30:45 (GMT) |
---|---|---|
committer | Jan Huwald <jh@sotun.de> | 2013-06-07 13:30:45 (GMT) |
commit | c6b663289c8a002a2d732c5efd53369a62394453 (patch) | |
tree | 930aa4d177c367b67e4e3e309480d5a2571eb5f3 /cacount.cpp | |
parent | 455a137b7bf8572637097767e4748eb3d9f5ed7a (diff) |
add mmalloc.hpp, support hugetlbfs allocation
Diffstat (limited to 'cacount.cpp')
-rw-r--r-- | cacount.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/cacount.cpp b/cacount.cpp index 012f33b..7abda2f 100644 --- a/cacount.cpp +++ b/cacount.cpp @@ -11,8 +11,7 @@ #include <set> #include <thread> -#include <sys/mman.h> - +#include "mmalloc.hpp" #include "packed_array.hpp" #include "timer.hpp" @@ -20,7 +19,7 @@ using namespace std; using boost::optional; #ifndef BIT_WIDTH -#define BIT_WIDTH 16 +#define BIT_WIDTH 30 #endif typedef uint64_t State; @@ -166,16 +165,6 @@ void printTraj(State s, int count) { } } -template<typename T> -T* mmalloc() { - void *p = MAP_FAILED; - for (auto flag : {MAP_POPULATE | MAP_HUGETLB, MAP_POPULATE, 0}) - if (p == MAP_FAILED) - p = mmap(NULL, sizeof(Trans), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | flag, -1, 0); - assert(p != MAP_FAILED); - return (T*) p; -} - int main(int argc, char **argv) { assert(argc >= 2); rule = atoi(argv[1]); |