20 #ifndef _TPIE_CPU_TIMER_H
21 #define _TPIE_CPU_TIMER_H
33 #include <boost/date_time.hpp>
35 #include <sys/times.h>
36 #include <sys/resource.h>
48 typedef boost::posix_time::ptime tms;
60 clock_t last_sync_real_;
61 clock_t elapsed_real_;
65 inline void set_clock_tick();
66 inline void last_sync_real_declaration();
148 return last_sync_real_;
155 return elapsed_real_;
165 std::ostream &operator<<(std::ostream &s, cpu_timer &ct);
169 #endif // _TPIE_CPU_TIMER_H
double system_time()
Linux: Query the amount of time spent by this process in kernel mode since the timer was reset...
tms last_sync() const
Return the timestamp of last sync.
double user_time()
Linux: Query the amount of time spent by this process in user mode since the timer was reset...
This file contains a few deprecated definitions for legacy code.
void reset()
Reset the timer to zero.
void sync()
Update fields such that running(), clock_tick(), elapsed(), elapsed_real() will return recent measure...
clock_t elapsed_real() const
Return the elapsed wall clock time at the last sync.
double wall_time()
Query the amount of wall clock time spent by this process since the timer was reset.
long clock_tick() const
Return number of ticks per wall clock second as reported by the OS.
bool running() const
Tell whether the timer is currently running.
tms elapsed() const
Return the timestamp indicating the elapsed time. Only useful on Linux.
clock_t last_sync_real() const
Return the wall clock timestamp of the last sync.
void start()
Start the timer.
void stop()
Stop the timer.