#include <tools.h>
Public Member Functions | |
| Timer () | |
| Default-Constructor. | |
| void | start () |
| Starts the timer. | |
| Timer & | stop () |
| Stops the timer. | |
| operator double () const | |
| Gives the elapsed time as double. | |
Static Public Member Functions | |
| static void | print (ostream &out, double time) |
| Prints the elapsed time. | |
Private Attributes | |
| timeval | starttime |
| Stores the starttime of this Timer. | |
| timeval | endtime |
| Stores the endtime of this Timer. | |
Friends | |
| ostream & | operator<< (ostream &out, Timer &w) |
| Output-operator. | |
Uses getrusage.
Definition at line 249 of file tools.h.
| Timer::Timer | ( | ) | [inline] |
| void Timer::start | ( | ) |
| Timer& Timer::stop | ( | ) |
| Timer::operator double | ( | ) | const |
Gives the elapsed time as double.
| static void Timer::print | ( | ostream & | out, | |
| double | time | |||
| ) | [static] |
Prints the elapsed time.
Prints the time-difference endtime-starttime in the format hour:minute:sec, where sec is printed with a precision of E-3 (milliseconds). You should have set the endtime by a call to stop().
| out | The ostream to print to. |
| ostream& operator<< | ( | ostream & | out, | |
| Timer & | w | |||
| ) | [friend] |
struct timeval Timer::starttime [private] |
struct timeval Timer::endtime [private] |
1.4.7