Timing nested tasks.
More...
#include <timer.hh>
Public Member Functions |
| timer () |
| timer (const timer &rhs) |
| ~timer () |
void | push (const std::string &name) |
void | push (int i) |
void | pop (const std::string &task_name) |
void | pop (int i) |
void | pop () |
| Stop the current task's timer(the last task pushed on the stack).
|
void | dump (std::ostream &out=std::cerr) |
void | dump_on_destruction (std::ostream &out) |
void | name (int i, const std::string &task_name) |
| Assign name task_name to task number i.
|
void | start () |
void | stop () |
timer & | operator<< (const timer &rhs) |
| Import timer.
|
Private Member Functions |
void | timeinfo (long time, long total_time, std::ostream &out) |
| Write formatted timing results on out.
|
Static Private Attributes |
static const long | clocks_per_sec = sysconf(_SC_CLK_TCK) |
Detailed Description
Member Typedef Documentation
Constructor & Destructor Documentation
misc::timer::timer |
( |
const timer & |
rhs | ) |
|
Member Function Documentation
void misc::timer::dump |
( |
std::ostream & |
out = std::cerr | ) |
|
void misc::timer::dump_on_destruction |
( |
std::ostream & |
out | ) |
|
|
inline |
void misc::timer::name |
( |
int |
i, |
|
|
const std::string & |
task_name |
|
) |
| |
Assign name task_name to task number i.
References intmap.
timer & misc::timer::operator<< |
( |
const timer & |
rhs | ) |
|
Import timer.
Import tasks defined in rhs. The total execution time of rhs is ignored.
- Precondition
- No task should be running in rhs.
References intmap, precondition, tasks, and tasksmap.
void misc::timer::pop |
( |
const std::string & |
task_name | ) |
|
|
inline |
void misc::timer::pop |
( |
int |
i | ) |
|
|
inline |
void misc::timer::pop |
( |
| ) |
|
void misc::timer::push |
( |
const std::string & |
name | ) |
|
void misc::timer::push |
( |
int |
i | ) |
|
|
inline |
void misc::timer::start |
( |
| ) |
|
|
inline |
void misc::timer::stop |
( |
| ) |
|
|
inline |
void misc::timer::timeinfo |
( |
long |
time, |
|
|
long |
total_time, |
|
|
std::ostream & |
out |
|
) |
| |
|
private |
Member Data Documentation
const long misc::timer::clocks_per_sec = sysconf(_SC_CLK_TCK) |
|
staticprivate |
Number of clocks ticks per second, set according to the system timing function used.
Referenced by dump(), and timeinfo().
std::ostream* misc::timer::dump_stream |
|
private |
A potential stream onto which results are dumped when the timer is destroyed. If this pointer is null, no action is taken during the destruction of the timer.
Referenced by dump_on_destruction(), and ~timer().
std::map<int, std::string> misc::timer::intmap |
|
private |
std::stack<time_var*> misc::timer::tasks |
|
private |
The documentation for this class was generated from the following files: