Public Member Functions | Private Attributes

ColPack::Timer Class Reference
[Auxiliary Classes]

class Timer in group4. More...

#include <Timer.h>

List of all members.

Public Member Functions

 Timer ()
 ~Timer ()
void Start ()
void Stop ()
double GetWallTime ()
double GetProcessorTime ()
double GetUserProcessorTime ()
double GetSystemProcessorTime ()

Private Attributes

struct tms tms_BeginTimer
 UNIX only. Used to measure longer execution time.
struct tms tms_EndTimer
clock_t ct_BeginTimer
clock_t ct_EndTimer

Detailed Description

class Timer in group4.

The timer class is the only class in ColPack which has an optional dependency on the operating system. It offers both system independent C++ timer based on ctime.h or linux/unix dependent timer based on sys/times.h. The sytem independent timer only gives wall clock time while linux/unix dependent timer gives wall, processor, user and system times.

Definition at line 52 of file Timer.h.


Constructor & Destructor Documentation

ColPack::Timer::Timer (  ) 

Definition at line 28 of file Timer.cpp.

ColPack::Timer::~Timer (  ) 

Definition at line 35 of file Timer.cpp.


Member Function Documentation

double ColPack::Timer::GetProcessorTime (  ) 

Definition at line 90 of file Timer.cpp.

References _UNKNOWN, tms_BeginTimer, and tms_EndTimer.

double ColPack::Timer::GetSystemProcessorTime (  ) 

Definition at line 127 of file Timer.cpp.

References _UNKNOWN, tms_BeginTimer, and tms_EndTimer.

double ColPack::Timer::GetUserProcessorTime (  ) 

Definition at line 109 of file Timer.cpp.

References _UNKNOWN, tms_BeginTimer, and tms_EndTimer.

double ColPack::Timer::GetWallTime (  ) 
void ColPack::Timer::Start (  ) 
void ColPack::Timer::Stop (  ) 

Member Data Documentation

clock_t ColPack::Timer::ct_BeginTimer [private]

Definition at line 69 of file Timer.h.

Referenced by GetWallTime(), and Start().

clock_t ColPack::Timer::ct_EndTimer [private]

Definition at line 70 of file Timer.h.

Referenced by GetWallTime(), and Stop().

struct tms ColPack::Timer::tms_BeginTimer [private]

UNIX only. Used to measure longer execution time.

Define SYSTEM_TIME to measure the execution time of a program which may run for more than 30 minutes (35.79 minutes or 2,147 seconds to be accurate) Reason: In UNIX, CLOCKS_PER_SEC is defined to be 1,000,000 (In Windows, CLOCKS_PER_SEC == 1,000). The # of clock-ticks is measured by using variables of type int => max value is 2,147,483,648. Time in seconds = # of clock-ticks / CLOCKS_PER_SEC => max Time in seconds = 2,147,483,648 / 1,000,000 ~= 2,147

Definition at line 65 of file Timer.h.

Referenced by GetProcessorTime(), GetSystemProcessorTime(), GetUserProcessorTime(), and Start().

struct tms ColPack::Timer::tms_EndTimer [private]

Definition at line 66 of file Timer.h.

Referenced by GetProcessorTime(), GetSystemProcessorTime(), GetUserProcessorTime(), and Stop().