TPIE

2362a60
tpie::cpu_timer Class Reference

Public Member Functions

void start ()
 Start the timer. More...
 
void stop ()
 Stop the timer. More...
 
void sync ()
 Update fields such that running(), clock_tick(), elapsed(), elapsed_real() will return recent measurements. More...
 
void reset ()
 Reset the timer to zero. More...
 
double user_time ()
 Linux: Query the amount of time spent by this process in user mode since the timer was reset. More...
 
double system_time ()
 Linux: Query the amount of time spent by this process in kernel mode since the timer was reset. More...
 
double wall_time ()
 Query the amount of wall clock time spent by this process since the timer was reset. More...
 
bool running () const
 Tell whether the timer is currently running. More...
 
long clock_tick () const
 Return number of ticks per wall clock second as reported by the OS. More...
 
tms last_sync () const
 Return the timestamp of last sync. More...
 
tms elapsed () const
 Return the timestamp indicating the elapsed time. Only useful on Linux. More...
 
clock_t last_sync_real () const
 Return the wall clock timestamp of the last sync. More...
 
clock_t elapsed_real () const
 Return the elapsed wall clock time at the last sync. More...
 

Detailed Description

Definition at line 52 of file cpu_timer.h.

Member Function Documentation

long tpie::cpu_timer::clock_tick ( ) const
inline

Return number of ticks per wall clock second as reported by the OS.

Definition at line 126 of file cpu_timer.h.

126  {
127  return clock_tick_;
128  }
tms tpie::cpu_timer::elapsed ( ) const
inline

Return the timestamp indicating the elapsed time. Only useful on Linux.

Definition at line 140 of file cpu_timer.h.

140  {
141  return elapsed_;
142  }
clock_t tpie::cpu_timer::elapsed_real ( ) const
inline

Return the elapsed wall clock time at the last sync.

Definition at line 154 of file cpu_timer.h.

154  {
155  return elapsed_real_;
156  }
tms tpie::cpu_timer::last_sync ( ) const
inline

Return the timestamp of last sync.

Definition at line 133 of file cpu_timer.h.

133  {
134  return last_sync_;
135  }
clock_t tpie::cpu_timer::last_sync_real ( ) const
inline

Return the wall clock timestamp of the last sync.

Definition at line 147 of file cpu_timer.h.

147  {
148  return last_sync_real_;
149  }
void tpie::cpu_timer::reset ( )

Reset the timer to zero.

bool tpie::cpu_timer::running ( ) const
inline

Tell whether the timer is currently running.

Definition at line 119 of file cpu_timer.h.

119  {
120  return running_;
121  }
void tpie::cpu_timer::start ( )

Start the timer.

void tpie::cpu_timer::stop ( )

Stop the timer.

void tpie::cpu_timer::sync ( )

Update fields such that running(), clock_tick(), elapsed(), elapsed_real() will return recent measurements.

double tpie::cpu_timer::system_time ( )

Linux: Query the amount of time spent by this process in kernel mode since the timer was reset.

Windows: Query the amount of wall clock time spent by this process since the timer was reset.

double tpie::cpu_timer::user_time ( )

Linux: Query the amount of time spent by this process in user mode since the timer was reset.

Windows: Query the amount of wall clock time spent by this process since the timer was reset.

double tpie::cpu_timer::wall_time ( )

Query the amount of wall clock time spent by this process since the timer was reset.


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