COIN-OR::LEMON - Graph Library

Changeset 425:4fbe868c1fb4 in lemon-0.x


Ignore:
Timestamp:
04/26/04 19:33:51 (16 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@565
Message:

Some more docs.
Put it into the 'misc' group.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci/time_measure.h

    r327 r425  
    22#ifndef HUGO_TIME_MEASURE_H
    33#define HUGO_TIME_MEASURE_H
     4
     5///ingroup graphs
     6///\file
     7///\brief Tools for measuring cpu usage
    48
    59#include <sys/time.h>
     
    1115namespace hugo {
    1216
    13 //   double currTime() {
    14 //     timeval tv;
    15 //     //timezone tz;
    16 //     gettimeofday(&tv, 0);
    17 //     return double(tv.tv_sec)+double(tv.tv_usec)/1000000.0;
    18 //   }
     17  /// \addtogroup misc
     18  /// @{
    1919
    20   /// Class to store (cpu)time instances.
     20  /// A class to store (cpu)time instances.
    2121
    2222  /// This class stores five time values.
     
    2828  ///
    2929  /// TimeStamp's can be added to or substracted from each other and
    30   /// they can be push to a stream.
     30  /// they can be pushed to a stream.
    3131
    3232  class TimeStamp
     
    3939    tms &getTms() {return ts;}
    4040    const tms &getTms() const {return ts;}
    41     double getRealTime() const {return real_time;}
    42     ///Read the current time values of the process.
     41    ///Read the current time values of the process
    4342    void stamp()
    4443    {
     
    4847    }
    4948 
    50     /// Constructor initializing with zero.
     49    /// Constructor initializing with zero
    5150    TimeStamp()
    5251    { ts.tms_utime=ts.tms_stime=ts.tms_cutime=ts.tms_cstime=0; real_time=0;}
    53     ///Constructor initializing with the current time values of the process.
     52    ///Constructor initializing with the current time values of the process
    5453    TimeStamp(void *) { stamp();}
    5554 
     55    ///
    5656    TimeStamp &operator+=(const TimeStamp &b)
    5757    {
     
    6363      return *this;
    6464    }
     65    ///
    6566    TimeStamp operator+(const TimeStamp &b) const
    6667    {
     
    6869      return t+=b;
    6970    }
     71    ///
    7072    TimeStamp &operator-=(const TimeStamp &b)
    7173    {
     
    7779      return *this;
    7880    }
     81    ///
    7982    TimeStamp operator-(const TimeStamp &b) const
    8083    {
     
    9295    friend std::ostream& operator<<(std::ostream& os,const TimeStamp &t);
    9396 
     97    ///Gives back the user time of the process
    9498    double getUserTime() const
    9599    {
    96100      return double(ts.tms_utime)/sysconf(_SC_CLK_TCK);
    97101    }
     102    ///Gives back the system time of the process
    98103    double getSystemTime() const
    99104    {
    100105      return double(ts.tms_stime)/sysconf(_SC_CLK_TCK);
    101106    }
     107    ///Gives back the user time of the process' children
    102108    double getCUserTime() const
    103109    {
    104110      return double(ts.tms_cutime)/sysconf(_SC_CLK_TCK);
    105111    }
     112    ///Gives back the user time of the process' children
    106113    double getCSystemTime() const
    107114    {
    108115      return double(ts.tms_cstime)/sysconf(_SC_CLK_TCK);
    109116    }
     117    ///Gives back the real time of the process
     118    double getRealTime() const {return real_time;}
    110119  };
    111120
    112   ///Class measuring the cpu time and real time usage of the process.
     121  ///Class measuring the cpu time and real time usage of the process
    113122  class Timer
    114123  {
     
    118127 
    119128  public:
    120     ///Constructor. It starts with zero time counters.
     129    ///Constructor. It starts with zero time counters
    121130    Timer() {_reset();}
    122131
    123     ///Computes the ellapsed time.
     132    ///Computes the ellapsed time
    124133
    125134    ///This conversion computes the ellapsed time
     
    133142    }
    134143
    135     ///Resets the time counters.
     144    ///Resets the time counters
    136145    TimeStamp reset()
    137146    {
     
    142151  };
    143152
    144   ///Prints the time counters.
     153  ///Prints the time counters
     154
     155  ///Prints the time counters in the folloing form:
     156  ///
     157  /// u: XX.XXs s: XX.XXs cu: XX.XXs cs: XX.XXs real: XX.XXs
     158  ///
     159  /// where the values are the
     160  /// - a user cpu time,
     161  /// - a system cpu time,
     162  /// - a user cpu time of children,
     163  /// - a system cpu time of children and
     164  /// - a real time,
     165  ///
     166  ///respectively
    145167  inline std::ostream& operator<<(std::ostream& os,const TimeStamp &t)
    146168  {
     
    154176  }
    155177
     178  /// @} 
     179
    156180} //namespace hugo
    157181
Note: See TracChangeset for help on using the changeset viewer.