#include <timer.h>
Public Methods | |
Timer (void) | |
default constructor. | |
void | start (void) |
Start the timer. | |
void | stop (void) |
Stop the timer. | |
void | reset (void) |
Reset the timer. | |
void | set (double secs) |
Set the timer. | |
operator double (void) | |
Return the number of seconds elapsed. | |
Private Attributes | |
long | _starttime |
The _timer variable will be different depending on the OS. We try to use the best timer available. | |
long | _elapsedtime |
The _timer variable will be different depending on the OS. We try to use the best timer available. |
Timer t;
t.start(); do hairy computation 1. t.stop();
cout << "The first hairy computation took " << (double) t << " seconds." << endl;
t.reset();
t.start(); do hairy computation 2. t.stop();
cout << "The second hairy computation took " << (double) t << " seconds." << endl;
Definition at line 81 of file timer.h.