Public Types | |
typedef std::map< const std::string, TimeVar > | task_map_type |
Public Member Functions | |
void | push (const std::string &name) |
Start a sub-timer for a named task. | |
void | push (const int i) |
Start a sub-timer with an integer which refers to a string. | |
void | pop (const std::string &task_name) |
Stop the named task. | |
void | pop (const int i) |
| |
void | pop () |
Stop the current task's timer (the last task pushed). | |
std::ostream & | print (std::ostream &o, const bool) const |
Write results. | |
void | print_on_destruction (std::ostream &out) |
Write results when the timer is destroyed. | |
void | name (int i, const std::string &name) |
The name function links an int and a constant string. | |
void | start () |
The start function must be called at the beginning of the program to get the total time spend in the whole program. | |
void | stop () |
The stop function must be called at the end of the program. | |
Timer & | operator<< (const Timer &rhs) |
Import timer. | |
Timer & | operator+= (const Timer &rhs) |
Accumulate another timer. | |
Timer & | operator/= (unsigned rhs) |
Divide in place. | |
Timer | operator/ (unsigned rhs) const |
Divide. | |
bool | operator< (const Timer &rhs) const |
Comparison between two Timers. | |
void | clear () |
Reset all timers to zero. | |
TimeVar & | operator[] (const std::string &s) |
std::ostream & | print_time (long t, long total, std::ostream &o) const |
Format timing results. | |
std::ostream & | print_time (std::string s, const Time &t, const Time &tot, std::ostream &o, const bool tree_mode) const |
Print statistics on a Time. | |
Friends | |
class | Bencher |
Classes | |
class | Time |
User, system and wall clock time convenient interface. More... | |
class | TimeVar |
An actual sub-timer. More... |
Definition at line 51 of file timer.hh.
void push | ( | const std::string & | name | ) |
Start a sub-timer for a named task.
name | a constant string which is the task's name |
Referenced by Timer::push(), and ScopedTimer::ScopedTimer().
void push | ( | const int | i | ) | [inline] |
Start a sub-timer with an integer which refers to a string.
Definition at line 39 of file timer.hxx.
References precondition, and Timer::push().
void pop | ( | const std::string & | task_name | ) | [inline] |
Stop the named task.
Take a const string as parameter that make sure that what is popped is indeed what is on top.
Definition at line 47 of file timer.hxx.
References Timer::pop(), and precondition.
Referenced by ScopedTimer::~ScopedTimer().
std::ostream& print | ( | std::ostream & | o, | |
const | bool | |||
) | const |
Write results.
o | an ostream. |
void print_on_destruction | ( | std::ostream & | out | ) | [inline] |
void name | ( | int | i, | |
const std::string & | name | |||
) |
The name function links an int and a constant string.
i | the integer key to register | |
name | the associated task name |
void start | ( | ) | [inline] |
The start function must be called at the beginning of the program to get the total time spend in the whole program.
Definition at line 70 of file timer.hxx.
References Timer::TimeVar::start().
void stop | ( | ) | [inline] |
The stop function must be called at the end of the program.
Definition at line 77 of file timer.hxx.
References Timer::TimeVar::stop().
Import timer.
Import tasks defined in rhs. There must be not stacked task. Total execution time of rhs is ignored.
bool operator< | ( | const Timer & | rhs | ) | const [inline] |
Comparison between two Timers.
This operators enables the use of std::min and std::max. It check only the total time, so it's a strict weak ordering.
Definition at line 104 of file timer.hxx.
References Timer::total.