#include "../../common/Clock.h" #include "../crush.h" using namespace crush; Clock g_clock; #include #include #include using namespace std; int branching = 10; bool linear = false; int numrep = 1; Bucket *make_bucket(Crush& c, vector& wid, int h, int& ndisks) { if (h == 0) { // uniform Hash hash(123); vector disks; for (int i=0; imake_primes(hash); c.add_bucket(b); //cout << h << " uniformbucket with " << wid[h] << " disks" << endl; return b; } else { // mixed Bucket *b; if (linear) b = new ListBucket(h+1); else b = new TreeBucket(h+1); for (int i=0; iadd_item(n->get_id(), n->get_weight()); } c.add_bucket(b); //cout << h << " mixedbucket with " << wid[h] << endl; return b; } } int make_hierarchy(Crush& c, vector& wid, int& ndisks) { Bucket *b = make_bucket(c, wid, wid.size()-1, ndisks); return b->get_id(); } double go(int s) { int dep = 2; Hash h(73232313); // crush Crush c; // buckets int root = -1; int ndisks = 0; vector wid; if (1) { //for (int d=0; d v(numrep); utime_t start = g_clock.now(); for (int x=1; x <= place; x++) c.do_rule(rule, x, v); utime_t end = g_clock.now(); end -= start; double el = (double)end; cout << "\t" << ndisks; return el; } int main() { branching = 8; int d = 2; numrep = 2; for (int s = 64; s <= 32768; s *= 8) { cout << "t"; linear = false; double el = go(s, d); cout << "\t" << el; cout << "\tp"; linear = true; el = go(s, d); cout << "\t" << el; cout << endl; } }