/*** Initialize the counter */ void bench_init() { SET = new RBTree(); // warm up the datastructure TM_BEGIN_FAST_INITIALIZATION(); for (uint32_t w = 0; w < CFG.elements; w+=2) SET->insert(w TM_PARAM); TM_END_FAST_INITIALIZATION(); }
/*** Initialize the counter */ void bench_init() { //SET = new RBTree(); SET = (RBTree*)sitemalloc(sizeof(RBTree)); new (SET) RBTree(); SET->RBTreeInit(); // warm up the datastructure TM_BEGIN_FAST_INITIALIZATION(); for (uint32_t w = 0; w < CFG.elements; w+=2) SET->insert(w TM_PARAM); TM_END_FAST_INITIALIZATION(); assert(SET->isSane()); }
/*** Initialize the counter */ void bench_init() { //SET = new HashTable(); //SET = (MAP_T*)hcmalloc(sizeof(MAP_T)); SET = MAP_ALLOC(NULL, NULL); //SET->init((CFG.elements/4)); std::cout << "startup " << std::endl; // warm up the datastructure TM_BEGIN_FAST_INITIALIZATION(); for (uint32_t w = 0; w < CFG.elements; w++) { uint32_t seed = 7; int val = rand_r(&seed) % CFG.elements; //SET->insert(val TM_PARAM); MAP_INSERT(SET, val, val); } TM_END_FAST_INITIALIZATION(); }
// constructor: create all the trees, intiialize them CustomForest(uint32_t keys, uint32_t ro, uint32_t numtrees, uint32_t per) : keydepths(keys), roratio(ro), insratio(ro + (100 - ro)/2), total_trees(numtrees), trees_per_tx(per), trees(new RBTree*[numtrees]) { // initialize the data structure TM_BEGIN_FAST_INITIALIZATION(); for (uint32_t i = 0; i < numtrees; ++i) { // make new tree trees[i] = new RBTree(); // populate it for (uint32_t w = 0; w < keys; w+=2) { // NB: gross hack: we can cheat here to avoid // instrumentation. it's safe since we're in the // constructor, but not advised in general. trees[i]->insert(w TM_PARAM); } } TM_END_FAST_INITIALIZATION(); }