[Lemon-commits] [lemon_svn] alpar: r445 - hugo/trunk/src/work/marci

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


Author: alpar
Date: Thu Apr 15 08:49:49 2004
New Revision: 445

Modified:
   hugo/trunk/src/work/marci/time_measure.h

Log:
Documentation.


Modified: hugo/trunk/src/work/marci/time_measure.h
==============================================================================
--- hugo/trunk/src/work/marci/time_measure.h	(original)
+++ hugo/trunk/src/work/marci/time_measure.h	Thu Apr 15 08:49:49 2004
@@ -17,6 +17,18 @@
 //     return double(tv.tv_sec)+double(tv.tv_usec)/1000000.0;
 //   }
 
+  /// Class to store (cpu)time instances.
+
+  /// This class stores five time values.
+  /// - a real time
+  /// - a user cpu time
+  /// - a system cpu time
+  /// - a user cpu time of children
+  /// - a system cpu time of children
+  ///
+  /// TimeStamp's can be added to or substracted from each other and
+  /// they can be push to a stream.
+
   class TimeStamp
   {
     tms ts;
@@ -27,6 +39,7 @@
     tms &getTms() {return ts;}
     const tms &getTms() const {return ts;}
     double getRealTime() const {return real_time;}
+    ///Read the current time values of the process.
     void stamp()
     {
       timeval tv;
@@ -34,9 +47,10 @@
       gettimeofday(&tv, 0);real_time=tv.tv_sec+double(tv.tv_usec)/1e6;
     }
   
+    /// Constructor initializing with zero.
     TimeStamp()
     { ts.tms_utime=ts.tms_stime=ts.tms_cutime=ts.tms_cstime=0; real_time=0;}
-  
+    ///Constructor initializing with the current time values of the process.
     TimeStamp(void *) { stamp();}
   
     TimeStamp &operator+=(const TimeStamp &b)
@@ -68,6 +82,7 @@
       return t-=b;
     }
 
+    ///The time ellapsed since the last call of stamp()
     TimeStamp ellapsed() const
     {
       TimeStamp t(NULL);
@@ -94,6 +109,7 @@
     }
   };
 
+  ///Class measuring the cpu time and real time usage of the process.
   class Timer
   {
     TimeStamp start_time;
@@ -101,8 +117,14 @@
     void _reset() {start_time.stamp();}
   
   public: 
+    ///Constructor. It starts with zero time counters.
     Timer() {_reset();}
 
+    ///Computes the ellapsed time.
+
+    ///This conversion computes the ellapsed time
+    ///since the construction of \c t or since
+    ///the last \c t.reset().
     operator TimeStamp ()
     {
       TimeStamp t;
@@ -110,6 +132,7 @@
       return t-start_time;
     }
 
+    ///Resets the time counters.
     TimeStamp reset()
     {
       TimeStamp t(start_time);
@@ -118,6 +141,7 @@
     }
   };
 
+  ///Prints the time counters.
   inline std::ostream& operator<<(std::ostream& os,const TimeStamp &t)
   {
     long cls = sysconf(_SC_CLK_TCK);



More information about the Lemon-commits mailing list