#include "ex_common.h" #include #include #include #include int len = 512; int cnt = 128; int thr = 1; #define REGION_SIZE (8*1024*1024*1024ULL) #if ALLOC == pmdk POBJ_LAYOUT_BEGIN(alloc); POBJ_LAYOUT_TOID(alloc, uint8_t); POBJ_LAYOUT_END(alloc); PMEMobjpool *pop; #define HEAP_FILE "/mnt/pmem0/pmdk.pool" int pm_init() { pop = pmemobj_create(HEAP_FILE, "test", REGION_SIZE, 0666); if (pop == nullptr) { perror("pmemobj_create"); return 1; } return 0; } void pm_close() { pmemobj_close(pop); } void *pm_alloc(size_t len) { void *dst = NULL; if(pmemobj_zalloc(pop, dst, TOID_TYPE_NUM(uint8_t), len)==0) return dst; return NULL; } #elif ALLOC == r int pm_init() { } void pm_close() { } void *pm_alloc(size_t len) { } #else int pm_init() {} void pm_close() {} void *pm_alloc(size_t len) { return malloc(len); } #endif void *worker(void *vargp) { for(int i=0; i