#include "../crush.h" using namespace crush; #include #include #include using namespace std; 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 = 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(); } float go(int dep) { Hash h(73232313); // crush Crush c; // buckets int root = -1; int ndisks = 0; vector wid; if (1) { for (int d=0; d ocount(ndisks); //cout << ndisks << " disks, " << endl; //cout << pg_per << " pgs per disk" << endl; // cout << numpg << " logical pgs" << endl; //cout << "numrep is " << numrep << endl; int place = 100000; int times = place / numpg; if (!times) times = 1; cout << "#looping " << times << " times" << endl; float tvar = 0; int tvarnum = 0; float tavg = 0; int x = 0; for (int t=0; t v(numrep); for (int z=0; z