1 #ifndef __PH_TIMER_2_H__
2 #define __PH_TIMER_2_H__
18 enum State { STOP, RUN };
22 timespec m_time_start;
25 unsigned int m_n_cycle;
28 PHTimer2(
const std::string& name=
"Generic Timer");
31 void set_name(
const std::string& name) { m_name = name; }
32 std::string
get_name()
const {
return m_name; }
43 void print_stat(std::string header=
" Timer2:", std::ostream& os=std::cout)
const;
46 void test(
unsigned int time_msec, std::ostream& os=std::cout);
Class to measure the time spent by a code block.
void print_stat(std::string header=" Timer2:", std::ostream &os=std::cout) const
PHTimer2(const std::string &name="Generic Timer")
unsigned int get_ncycle() const
double elapsed() const
In millisecond.
double get_accumulated_time() const
void test(unsigned int time_msec, std::ostream &os=std::cout)
Test this class by waiting for a given time (in ms).
double get_time_per_cycle() const
std::string get_name() const
int get_clock_time(timespec *tp)
void set_name(const std::string &name)