[yoda-svn] r402 - trunk/tests/Histo2D

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Oct 24 20:17:07 BST 2011


Author: mkawalec
Date: Mon Oct 24 20:17:07 2011
New Revision: 402

Log:
Commented out the benchmarking tests.

Modified:
   trunk/tests/Histo2D/H2DFill.cc

Modified: trunk/tests/Histo2D/H2DFill.cc
==============================================================================
--- trunk/tests/Histo2D/H2DFill.cc	Mon Oct 24 15:36:55 2011	(r401)
+++ trunk/tests/Histo2D/H2DFill.cc	Mon Oct 24 20:17:07 2011	(r402)
@@ -11,6 +11,7 @@
 using namespace YODA;
 
 int main() {
+  ios_base::sync_with_stdio(0);
   Histo2D h(200, 0, 100, 200, 0, 100);
   
   struct timeval startTime;
@@ -34,11 +35,11 @@
   }
   cout << "PASS (" << tE - tS << "s)" << endl;
 
-  cout << "Now, generating benchmark...             ";
+/*  cout << "Now, generating benchmark...             ";
   ofstream file("bench2.dat");
 
   for(int i = 10; i < 310; i+=10){
-    Histo2D temp(i, 0, 100, i, 0, 100);
+    Histo2D temp(i, 0, 99.5231, i, 0, 99.501293);
 
     gettimeofday(&startTime, NULL);
     for(int j = 0; j < 100000; j++) temp.fill(99, 99, 2);
@@ -72,8 +73,55 @@
     cout << i << endl;
   }
   cout << endl;
+  
+  cout << "Doing the second (add/rem/modify) bench  ";
+  ofstream file2("bench.dat");
+  for(int i=10; i < 310; i+=10){
+    cout << i << endl;
+    Histo2D temp(i, 0, 100, i, 0, 100);
+    double totalTime = 0;
+    for(int z =0; z < 10; z++){
+      gettimeofday(&startTime, NULL);
+      for(int j=0; j < 1000; j++) temp.addBin(i*100, i,(i+1)*100, i+1);
+      gettimeofday(&endTime, NULL);
+      tE = (endTime.tv_sec*1000000 + endTime.tv_usec)/(double)1000000; 
+      tS = (startTime.tv_sec*1000000 + startTime.tv_usec)/(double)1000000;
+      totalTime+= tE-tS;
+    }
+    file2 << i*i << " " << totalTime/10 << " ";
+    cout << tE-tS << endl;
+    if(i>sqrt(1000)){
+      gettimeofday(&startTime, NULL);
+      for(int j=0; j<1000; j++) temp.eraseBin(0);
+      gettimeofday(&endTime, NULL);
+      tE = (endTime.tv_sec*1000000 + endTime.tv_usec)/(double)1000000; 
+      tS = (startTime.tv_sec*1000000 + startTime.tv_usec)/(double)1000000;
+      file2 << tE-tS << " ";
+      cout << tE-tS << endl;
+    }
+    else file2 << 0 << " ";
 
-
+    Histo2D temp2(i, 0, 100, i, 0, 100);
+    gettimeofday(&startTime, NULL);
+    temp2.mergeBins(0, temp2.numBins()-1);
+    gettimeofday(&endTime, NULL);
+    tE = (endTime.tv_sec*1000000 + endTime.tv_usec)/(double)1000000; 
+    tS = (startTime.tv_sec*1000000 + startTime.tv_usec)/(double)1000000;
+    file2 << tE-tS << endl;
+    cout << "Merge: " << tE-tS << endl;*/
+   /*
+    
+    Histo2D temp3(i, 0, 100, i, 0, 100);
+    gettimeofday(&startTime, NULL);
+    temp3.rebin(temp3.numBinsX()-1, temp3.numBinsY()-1);
+    gettimeofday(&endTime, NULL);
+    tE = (endTime.tv_sec*1000000 + endTime.tv_usec)/(double)1000000; 
+    tS = (startTime.tv_sec*1000000 + startTime.tv_usec)/(double)1000000;
+    file2 << tE-tS << endl;
+    cout << "Rebin: " << tE-tS << endl;
+  */ 
+    
+  }
 
   // Testing if fill() function does what it should
   cout << "Does fill() do what it should?           ";


More information about the yoda-svn mailing list