]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/old: Removed commented code 15366/head
authorJos Collin <jcollin@redhat.com>
Tue, 30 May 2017 15:30:47 +0000 (21:00 +0530)
committerJos Collin <jcollin@redhat.com>
Tue, 30 May 2017 15:31:22 +0000 (21:01 +0530)
There were lot of commented code inside src/test/old/testcrush.cc. This was found while doing
the PR#15364. Removed them.

Signed-off-by: Jos Collin <jcollin@redhat.com>
src/test/old/testcrush.cc

index bd432b23ee95caf0366357e35ded431e15b2cfae..56bb7240eaafbd3d5c1480f825f437e90f5ee01d 100644 (file)
@@ -1,5 +1,3 @@
-
-
 #include "../crush/crush.h"
 using namespace crush;
 
@@ -9,19 +7,6 @@ using namespace crush;
 #include <vector>
 using namespace std;
 
-/*
-ostream& operator<<(ostream& out, vector<int>& v)
-{
-  out << "[";
-  for (int i=0; i<v.size(); i++) {
-    if (i) out << " ";
-    out << v[i];
-  }
-  out << "]";
-  return out;
-}
-*/
-
 void make_disks(int n, int& no, vector<int>& d) 
 {
   d.clear();
@@ -32,7 +17,6 @@ void make_disks(int n, int& no, vector<int>& d)
   }
 }
 
-
 Bucket *make_bucket(Crush& c, vector<int>& wid, int h, int& ndisks, int& nbuckets)
 {
   if (h == 0) {
@@ -44,7 +28,6 @@ Bucket *make_bucket(Crush& c, vector<int>& wid, int h, int& ndisks, int& nbucket
     UniformBucket *b = new UniformBucket(nbuckets--, 1, 0, 10, disks);
     b->make_primes(hash);  
     c.add_bucket(b);
-    //cout << h << " uniformbucket with " << wid[h] << " disks" << endl;
     return b;
   } else {
     // mixed
@@ -54,7 +37,6 @@ Bucket *make_bucket(Crush& c, vector<int>& wid, int h, int& ndisks, int& nbucket
       b->add_item(n->get_id(), n->get_weight());
     }
     c.add_bucket(b);
-    //cout << h << " mixedbucket with " << wid[h] << endl;
     return b;
   }
 }
@@ -74,7 +56,6 @@ int main()
   // crush
   Crush c;
 
-
   // buckets
   vector<int> disks;
   int root = -1;
@@ -107,10 +88,7 @@ int main()
     c.add_bucket(&umb1);
     
     MixedBucket b(-100, 1);
-    //b.add_item(-2, ub1.get_weight());
     b.add_item(-4, umb1.get_weight());
-    //b.add_item(-2, ub2.get_weight());
-    //b.add_item(-3, ub3.get_weight());
   }
 
   if (0) {
@@ -132,7 +110,6 @@ int main()
           for (int k=0; k<n; k++)
             d->add_item(disks[k], 10);
           
-          //b->add_item(disks[j], 10);
           c.add_bucket(d);
           b->add_item(d->get_id(), d->get_weight());
         }
@@ -161,8 +138,6 @@ int main()
     root = make_hierarchy(c, wid, ndisks, nbuckets);
   }
   
-
-
   // rule
   int numrep = 1;
 
@@ -172,19 +147,11 @@ int main()
     rule.steps.push_back(RuleStep(CRUSH_RULE_CHOOSE, numrep, 0));
   }
   if (1) {
-    /*
-    rule.steps.push_back(RuleStep(CRUSH_RULE_TAKE, -4));
-    rule.steps.push_back(RuleStep(CRUSH_RULE_CHOOSE, 2, 0));
-    rule.steps.push_back(RuleStep(CRUSH_RULE_EMIT));
-    */
     rule.steps.push_back(RuleStep(CRUSH_RULE_TAKE, root));
     rule.steps.push_back(RuleStep(CRUSH_RULE_CHOOSE, 1, 0));
     rule.steps.push_back(RuleStep(CRUSH_RULE_EMIT));
   }
 
-  //c.overload[10] = .1;
-
-
   int pg_per = 100;
   int numpg = pg_per*ndisks/numrep;
   
@@ -213,14 +180,10 @@ int main()
     for (int xx=1; xx<numpg; xx++) {
       x++;
 
-      //cout << H(x) << "\t" << h(x) << endl;
       c.do_rule(rule, x, v);
-      //cout << "v = " << v << endl;// " " << v[0] << " " << v[1] << "  " << v[2] << endl;
       
       bool bad = false;
       for (int i=0; i<numrep; i++) {
-        //int d = b.choose_r(x, i, h);
-        //v[i] = d;
         ocount[v[i]]++;
         for (int j=i+1; j<numrep; j++) {
           if (v[i] == v[j]) 
@@ -229,16 +192,8 @@ int main()
       }
       if (bad)
         cout << "bad set " << x << ": " << v << endl;
-      
-      //cout << v << "\t" << ocount << endl;
     }
     
-    /*
-      for (int i=0; i<ocount.size(); i++) {
-      cout << "disk " << i << " has " << ocount[i] << endl;
-      }
-    */
-    
     cout << "collisions: " << c.collisions << endl;
     cout << "r bumps: " << c.bumps << endl;
     
@@ -261,6 +216,4 @@ int main()
   tvar /= tvarnum;
 
   cout << "total variance " << tvar << endl;
-
-
 }