- Timer class got direct access to the components of the ellapsed time/
authoralpar
Wed, 17 Nov 2004 22:18:30 +0000
changeset 100563ccf7136641
parent 1004 b94037830dc8
child 1006 aa8c2f05b9ab
- Timer class got direct access to the components of the ellapsed time/
- Better docs.
src/lemon/time_measure.h
     1.1 --- a/src/lemon/time_measure.h	Wed Nov 17 19:56:46 2004 +0000
     1.2 +++ b/src/lemon/time_measure.h	Wed Nov 17 22:18:30 2004 +0000
     1.3 @@ -71,7 +71,7 @@
     1.4      ///Constructor initializing with the current time values of the process
     1.5      TimeStamp(void *) { stamp();}
     1.6    
     1.7 -    ///
     1.8 +    ///\e
     1.9      TimeStamp &operator+=(const TimeStamp &b)
    1.10      {
    1.11        ts.tms_utime+=b.ts.tms_utime;
    1.12 @@ -81,13 +81,13 @@
    1.13        real_time+=b.real_time;
    1.14        return *this;
    1.15      }
    1.16 -    ///
    1.17 +    ///\e
    1.18      TimeStamp operator+(const TimeStamp &b) const
    1.19      {
    1.20        TimeStamp t(*this);
    1.21        return t+=b;
    1.22      }
    1.23 -    ///
    1.24 +    ///\e
    1.25      TimeStamp &operator-=(const TimeStamp &b)
    1.26      {
    1.27        ts.tms_utime-=b.ts.tms_utime;
    1.28 @@ -97,13 +97,12 @@
    1.29        real_time-=b.real_time;
    1.30        return *this;
    1.31      }
    1.32 -    ///
    1.33 +    ///\e
    1.34      TimeStamp operator-(const TimeStamp &b) const
    1.35      {
    1.36        TimeStamp t(*this);
    1.37        return t-=b;
    1.38      }
    1.39 -
    1.40      ///The time ellapsed since the last call of stamp()
    1.41      TimeStamp ellapsed() const
    1.42      {
    1.43 @@ -180,7 +179,7 @@
    1.44      ///This conversion computes the ellapsed time
    1.45      ///since the construction of \c t or since
    1.46      ///the last \c t.reset().
    1.47 -    operator TimeStamp ()
    1.48 +    operator TimeStamp () const
    1.49      {
    1.50        TimeStamp t;
    1.51        t.stamp();
    1.52 @@ -194,6 +193,34 @@
    1.53        _reset();
    1.54        return start_time-t;
    1.55      }
    1.56 +
    1.57 +
    1.58 +    ///Gives back the ellapsed user time of the process
    1.59 +    double getUserTime() const
    1.60 +    {
    1.61 +      return operator TimeStamp().getUserTime();
    1.62 +    }
    1.63 +    ///Gives back the ellapsed system time of the process
    1.64 +    double getSystemTime() const
    1.65 +    {
    1.66 +      return operator TimeStamp().getSystemTime();
    1.67 +    }
    1.68 +    ///Gives back the ellapsed user time of the process' children
    1.69 +    double getCUserTime() const
    1.70 +    {
    1.71 +      return operator TimeStamp().getCUserTime();
    1.72 +    }
    1.73 +    ///Gives back the ellapsed user time of the process' children
    1.74 +    double getCSystemTime() const
    1.75 +    {
    1.76 +      return operator TimeStamp().getCSystemTime();
    1.77 +    }
    1.78 +    ///Gives back the ellapsed real time of the process
    1.79 +    double getRealTime() const
    1.80 +    {
    1.81 +      return operator TimeStamp().getRealTime();
    1.82 +    }
    1.83 +
    1.84    };
    1.85  
    1.86    ///Prints the time counters