lemon/time_measure.h
changeset 2552 5f711e4668f5
parent 2408 467ca6d16556
child 2553 bfced05fa852
equal deleted inserted replaced
20:e34758f0e65d 21:453afe3de9bc
   239   /// int main()
   239   /// int main()
   240   /// {
   240   /// {
   241   ///
   241   ///
   242   ///   ...
   242   ///   ...
   243   ///
   243   ///
   244   ///   Timer T;
   244   ///   Timer t;
   245   ///   doSomething();
   245   ///   doSomething();
   246   ///   std::cout << T << '\n';
   246   ///   std::cout << t << '\n';
   247   ///   T.restart();
   247   ///   t.restart();
   248   ///   doSomethingElse();
   248   ///   doSomethingElse();
   249   ///   std::cout << T << '\n';
   249   ///   std::cout << t << '\n';
   250   ///
   250   ///
   251   ///   ...
   251   ///   ...
   252   ///
   252   ///
   253   /// }
   253   /// }
   254   ///\endcode
   254   ///\endcode
   259   ///
   259   ///
   260   ///\warning Depending on the operation system and its actual configuration
   260   ///\warning Depending on the operation system and its actual configuration
   261   ///the time counters have a certain (10ms on a typical Linux system)
   261   ///the time counters have a certain (10ms on a typical Linux system)
   262   ///granularity.
   262   ///granularity.
   263   ///Therefore this tool is not appropriate to measure very short times.
   263   ///Therefore this tool is not appropriate to measure very short times.
   264   ///Also, if you start and stop the timer very frequently, it could lead
   264   ///Also, if you start and stop the timer very frequently, it could lead to
   265   ///distorted results.
   265   ///distorted results.
   266   ///
   266   ///
   267   ///\note If you want to measure the running time of the execution of a certain
   267   ///\note If you want to measure the running time of the execution of a certain
   268   ///function, consider the usage of \ref TimeReport instead.
   268   ///function, consider the usage of \ref TimeReport instead.
   269   ///
   269   ///
   346       }
   346       }
   347     }
   347     }
   348 
   348 
   349     ///Halt (i.e stop immediately) the time counters
   349     ///Halt (i.e stop immediately) the time counters
   350 
   350 
   351     ///This function stops immediately the time counters.
   351     ///This function stops immediately the time counters, i.e. <tt>t.stop()</tt>
       
   352     ///is a faster
       
   353     ///equivalent of the following.
       
   354     ///\code
       
   355     ///  while(t.running()) t.stop()
       
   356     ///\endcode
       
   357     ///
   352     ///
   358     ///
   353     ///\sa stop()
   359     ///\sa stop()
   354     ///\sa restart()
   360     ///\sa restart()
   355     ///\sa reset()
   361     ///\sa reset()
   356 
   362 
   420     ///Computes the ellapsed time
   426     ///Computes the ellapsed time
   421 
   427 
   422     ///This conversion computes the ellapsed time, therefore you can print
   428     ///This conversion computes the ellapsed time, therefore you can print
   423     ///the ellapsed time like this.
   429     ///the ellapsed time like this.
   424     ///\code
   430     ///\code
   425     ///  Timer T;
   431     ///  Timer t;
   426     ///  doSomething();
   432     ///  doSomething();
   427     ///  std::cout << T << '\n';
   433     ///  std::cout << t << '\n';
   428     ///\endcode
   434     ///\endcode
   429     operator TimeStamp () const
   435     operator TimeStamp () const
   430     {
   436     {
   431       TimeStamp t;
   437       TimeStamp t;
   432       t.stamp();
   438       t.stamp();
   442   ///Same as \ref Timer but prints a report on destruction.
   448   ///Same as \ref Timer but prints a report on destruction.
   443   ///This example shows its usage.
   449   ///This example shows its usage.
   444   ///\code
   450   ///\code
   445   ///  void myAlg(ListGraph &g,int n)
   451   ///  void myAlg(ListGraph &g,int n)
   446   ///  {
   452   ///  {
   447   ///    TimeReport TR("Running time of myAlg: ");
   453   ///    TimeReport tr("Running time of myAlg: ");
   448   ///    ... //Here comes the algorithm
   454   ///    ... //Here comes the algorithm
   449   ///  }
   455   ///  }
   450   ///\endcode
   456   ///\endcode
   451   ///
   457   ///
   452   ///\sa Timer
   458   ///\sa Timer