src/include/time_measure.h
changeset 487 11ad69691d18
parent 440 f92099d27236
child 491 4804c967543d
equal deleted inserted replaced
2:7d2973b49446 3:4e932bb9bac3
    26   /// - a user cpu time of children
    26   /// - a user cpu time of children
    27   /// - a system cpu time of children
    27   /// - a system cpu time of children
    28   ///
    28   ///
    29   /// TimeStamp's can be added to or substracted from each other and
    29   /// TimeStamp's can be added to or substracted from each other and
    30   /// they can be pushed to a stream.
    30   /// they can be pushed to a stream.
       
    31   ///
       
    32   /// In most cases, perhaps \ref Timer class is what you want to use instead.
       
    33   ///
       
    34   ///\author Alpar Juttner
    31 
    35 
    32   class TimeStamp
    36   class TimeStamp
    33   {
    37   {
    34     tms ts;
    38     tms ts;
    35     double real_time;
    39     double real_time;
   117     ///Gives back the real time of the process
   121     ///Gives back the real time of the process
   118     double getRealTime() const {return real_time;}
   122     double getRealTime() const {return real_time;}
   119   };
   123   };
   120 
   124 
   121   ///Class measuring the cpu time and real time usage of the process
   125   ///Class measuring the cpu time and real time usage of the process
       
   126 
       
   127   ///Class measuring the cpu time and real time usage of the process.
       
   128   ///It is quite easy-to-use, here is a short example.
       
   129   ///\code
       
   130   ///int main()
       
   131   ///{
       
   132   ///
       
   133   ///  ...
       
   134   ///
       
   135   ///  Timer T();
       
   136   ///  doSomething();
       
   137   ///  cout << T;
       
   138   ///  T.reset();
       
   139   ///  doSomethingElse();
       
   140   ///  cout << T;
       
   141   ///
       
   142   ///  ...
       
   143   ///
       
   144   ///}
       
   145   ///\endcode
       
   146   ///
       
   147   ///\todo This shouldn't be Unix (Linux) specific.
       
   148   ///
       
   149   ///\author Alpar Juttner
   122   class Timer
   150   class Timer
   123   {
   151   {
   124     TimeStamp start_time;
   152     TimeStamp start_time;
   125 
   153 
   126     void _reset() {start_time.stamp();}
   154     void _reset() {start_time.stamp();}