.
authoralpar
Mon, 23 Feb 2004 17:33:50 +0000
changeset 1248d24100ad408
parent 123 2d1da2e1644a
child 125 7d7dc3fab826
.
src/work/marci/time_measure.h
     1.1 --- a/src/work/marci/time_measure.h	Mon Feb 23 16:38:49 2004 +0000
     1.2 +++ b/src/work/marci/time_measure.h	Mon Feb 23 17:33:50 2004 +0000
     1.3 @@ -76,23 +76,19 @@
     1.4    
     1.5    double getUserTime() const
     1.6    {
     1.7 -    long cls = sysconf(_SC_CLK_TCK);
     1.8 -    return double(ts.tms_utime)/cls;
     1.9 +    return double(ts.tms_utime)/sysconf(_SC_CLK_TCK);
    1.10    }
    1.11    double getSystemTime() const
    1.12    {
    1.13 -    long cls = sysconf(_SC_CLK_TCK);
    1.14 -    return double(ts.tms_stime)/cls;
    1.15 +    return double(ts.tms_stime)/sysconf(_SC_CLK_TCK);
    1.16    }
    1.17    double getCUserTime() const
    1.18    {
    1.19 -    long cls = sysconf(_SC_CLK_TCK);
    1.20 -    return double(ts.tms_cutime)/cls;
    1.21 +    return double(ts.tms_cutime)/sysconf(_SC_CLK_TCK);
    1.22    }
    1.23    double getCSystemTime() const
    1.24    {
    1.25 -    long cls = sysconf(_SC_CLK_TCK);
    1.26 -    return double(ts.tms_cstime)/cls;
    1.27 +    return double(ts.tms_cstime)/sysconf(_SC_CLK_TCK);
    1.28    }
    1.29  };
    1.30  
    1.31 @@ -100,16 +96,25 @@
    1.32  {
    1.33    TimeStamp start_time;
    1.34  
    1.35 +  void _reset() {start_time.stamp();}
    1.36 +
    1.37  public: 
    1.38 -  void reset() {start_time.stamp();}
    1.39 -  Timer() {reset();}
    1.40 +  Timer() {_reset();}
    1.41  
    1.42    operator TimeStamp ()
    1.43    {
    1.44      TimeStamp t;
    1.45      t.stamp();
    1.46      return t-start_time;
    1.47 -  }  
    1.48 +  }
    1.49 +  
    1.50 +  TimeStamp reset()
    1.51 +  {
    1.52 +    TimeStamp t(start_time);
    1.53 +    _reset();
    1.54 +    return start_time-t;
    1.55 +  }
    1.56 +
    1.57  };
    1.58  
    1.59  inline std::ostream& operator<<(std::ostream& os,const TimeStamp &t)