Timer Class Reference

#include <Timer.hpp>

List of all members.

Public Member Functions

void start ()
void stop ()
 Timer ()

Private Member Functions

real_t __cpuTime ()

Private Attributes

real_t __startTimeCPU
real_t __stopTimeCPU
time_t __startTime
time_t __stopTime
bool __started
bool __stopped
struct tms tp

Friends

std::ostream & operator<< (std::ostream &os, const Timer &T)


Detailed Description

Definition at line 48 of file Timer.hpp.


Constructor & Destructor Documentation

Timer::Timer (  )  [inline]

Definition at line 110 of file Timer.hpp.

00112     : __startTimeCPU(0),
00113       __stopTimeCPU(0),
00114       __startTime(0),
00115       __stopTime(0),
00116       __started(false),
00117       __stopped(false)
00118 #endif // __MINGW32__
00119   {
00120     ;
00121   }


Member Function Documentation

real_t Timer::__cpuTime (  )  [inline, private]

Definition at line 63 of file Timer.hpp.

References tp.

Referenced by start(), and stop().

00064   {
00065     static const long _CLK_TCK = sysconf(_SC_CLK_TCK);
00066     times(&tp);
00067     return static_cast<real_t>(tp.tms_utime)/_CLK_TCK;
00068   }

void Timer::start (  )  [inline]

void Timer::stop (  )  [inline]


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Timer T 
) [friend]

Definition at line 95 of file Timer.hpp.

00096   {
00097 #ifndef __MINGW32__
00098     if (!T.__stopped) {
00099       os << "Timer not stopped\n";
00100       return os;
00101     }
00102     os << "time: " << std::difftime(T.__stopTime, T.__startTime) << 's'
00103        << " - CPU time: " << T.__stopTimeCPU - T.__startTimeCPU << 's';
00104 #else // __MINGW32__
00105     os << "time: not implemented under windows";
00106 #endif // __MINGW32__
00107     return os;
00108   }


Member Data Documentation

real_t Timer::__startTimeCPU [private]

Definition at line 52 of file Timer.hpp.

Referenced by start().

real_t Timer::__stopTimeCPU [private]

Definition at line 53 of file Timer.hpp.

Referenced by stop().

time_t Timer::__startTime [private]

Definition at line 55 of file Timer.hpp.

Referenced by start().

time_t Timer::__stopTime [private]

Definition at line 56 of file Timer.hpp.

Referenced by stop().

bool Timer::__started [private]

Definition at line 58 of file Timer.hpp.

Referenced by start(), and stop().

bool Timer::__stopped [private]

Definition at line 59 of file Timer.hpp.

Referenced by start(), and stop().

struct tms Timer::tp [read, private]

Definition at line 61 of file Timer.hpp.

Referenced by __cpuTime().


The documentation for this class was generated from the following file:

Generated on Wed Nov 19 00:16:25 2008 for FreeFEM3D (aka ff3d) by  doxygen 1.5.6