code::ProcessTimerT< T > Class Template Reference

List of all members.

Detailed Description

template<class T>
class code::ProcessTimerT< T >

The ProcessTimerT object can be used to time short (under 30min) of processor or wall clock time, and memory resources used.

If used for logging, the ProcessTimerT object will print the string along with the CPU milliseconds elapsed (and additional memory resources used) since the object was constructed. The printing happens when the object is destroyed.

Nesting of ProcessTimerT is not allowed. The template class T should provide allow << to be done to it.

       {
          ProcessTimerT<ErrorLog::Streams> timer("doTask() took ",
                                                 ErrorLogInfo );
          doTask();
       }
     
will produce the output:
     doTask() took 23 msec
     
for example, when the task is completed.

If not used for logging, the typical usage is to repeatedly call getElapsedTime or getCPU time.

See also:
ProcessTimer for a more convenient class that uses std::ostream


Public Member Functions

 ProcessTimerT (const std::string &message, T &os)
 Constructor if you want logging.
 ProcessTimerT ()
 Use this constructor if you don't require lifecycle logging.
TimeInterval getElapsedTime ()
 The elapsed time from the creation of this object.
TimeInterval getCPUTime ()
 The CPU time used by this process, its children and by the system on behalf of this process since the creation of this object.
int getProgramSize ()
 The memory currently being used by this program, in pages.
 ~ProcessTimerT ()
 If logging is required, logs the CPU time taken since construction.


Constructor & Destructor Documentation

template<class T>
code::ProcessTimerT< T >::ProcessTimerT ( const std::string &  message,
T &  os 
) [inline]

Constructor if you want logging.

        ProcessTimer timer("method() took ", std::cout )
        

template<class T>
code::ProcessTimerT< T >::ProcessTimerT (  )  [inline]

Use this constructor if you don't require lifecycle logging.

template<class T>
code::ProcessTimerT< T >::~ProcessTimerT (  )  [inline]

If logging is required, logs the CPU time taken since construction.


Member Function Documentation

template<class T>
TimeInterval code::ProcessTimerT< T >::getCPUTime (  )  [inline]

The CPU time used by this process, its children and by the system on behalf of this process since the creation of this object.

template<class T>
TimeInterval code::ProcessTimerT< T >::getElapsedTime (  )  [inline]

The elapsed time from the creation of this object.

template<class T>
int code::ProcessTimerT< T >::getProgramSize (  )  [inline]

The memory currently being used by this program, in pages.


Generated on Fri May 4 13:40:13 2012 for WDSS-IIw2 by  doxygen 1.4.7