[cig-commits] r11767 - cs/benchmark/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Tue Apr 8 17:35:12 PDT 2008


Author: luis
Date: 2008-04-08 17:35:12 -0700 (Tue, 08 Apr 2008)
New Revision: 11767

Modified:
   cs/benchmark/cigma/trunk/src/EvalCmd.cpp
Log:
Add timer to EvalCmd main loop


Modified: cs/benchmark/cigma/trunk/src/EvalCmd.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/EvalCmd.cpp	2008-04-09 00:35:11 UTC (rev 11766)
+++ cs/benchmark/cigma/trunk/src/EvalCmd.cpp	2008-04-09 00:35:12 UTC (rev 11767)
@@ -1,8 +1,10 @@
 #include <iostream>
+#include <iomanip>
 #include <cassert>
 #include "EvalCmd.h"
 #include "ZeroField.h"
 #include "StringUtils.h"
+#include "Timer.h"
 
 using namespace std;
 using namespace cigma;
@@ -163,12 +165,34 @@
     // data
     double *phi = new double[npts * valdim];
 
+    Timer timer;
+    const int outputFrequency = 1000;
+    if (verbose)
+    {
+        cout << setprecision(5);
+        timer.print_header(cout, "points");
+        timer.start(npts);
+        timer.update(0);
+        cout << timer;
+    }
+
     for (i = 0; i < npts; i++)
     {
         double *globalPoint = (*points)[i];
         field->eval(globalPoint, &phi[valdim*i]);
+        if (verbose && ((i+1) % outputFrequency == 0))
+        {
+            timer.update(i+1);
+            cout << timer;
+        }
     }
 
+    if (verbose)
+    {
+        timer.update(npts);
+        cout << timer << endl;
+    }
+
     
     //
     // output values dataset



More information about the cig-commits mailing list