[Lemon-commits] [lemon_svn] alpar: r2536 - in hugo/trunk: lemon test

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:53:23 CET 2006


Author: alpar
Date: Mon Feb  6 10:11:53 2006
New Revision: 2536

Modified:
   hugo/trunk/lemon/time_measure.h
   hugo/trunk/test/time_measure_test.cc

Log:
- Increased max. number of iteration
- Better tests.


Modified: hugo/trunk/lemon/time_measure.h
==============================================================================
--- hugo/trunk/lemon/time_measure.h	(original)
+++ hugo/trunk/lemon/time_measure.h	Mon Feb  6 10:11:53 2006
@@ -515,7 +515,7 @@
     Timer t;
     TimeStamp full;
     int total=0;
-    for(int tn=1;tn < 1<<24; tn*=2) {
+    for(int tn=1;tn < 1<<30; tn*=2) {
       for(;total<tn;total++) f();
       full=t;
       if(full.realTime()>min_time) {

Modified: hugo/trunk/test/time_measure_test.cc
==============================================================================
--- hugo/trunk/test/time_measure_test.cc	(original)
+++ hugo/trunk/test/time_measure_test.cc	Mon Feb  6 10:11:53 2006
@@ -28,10 +28,19 @@
 void f() 
 {
   double d=0;
-  for(int i=0;i<10000;i++)
+  for(int i=0;i<1000;i++)
     d+=0.1;
 }
 
+void g() 
+{
+  static Timer T;
+  
+  double d=0;
+  for(int i=0;i<1000;i++)
+    TimeStamp x(T);
+}
+
 int main()
 {
   Timer T;
@@ -42,7 +51,12 @@
   while(T.realTime()<2.0) ;
   std::cout << T << '\n';
   TimeStamp full;
-  TimeStamp t=runningTimeTest(f,1,&n,&full);
+  TimeStamp t;
+  t=runningTimeTest(f,1,&n,&full);
+  std::cout << t << " (" << n << " tests)\n";
+  std::cout << "Total: " << full << "\n";
+  
+  t=runningTimeTest(g,1,&n,&full);
   std::cout << t << " (" << n << " tests)\n";
   std::cout << "Total: " << full << "\n";
   



More information about the Lemon-commits mailing list