#include <timer.hh>
Collaboration diagram for oln::utils::timer:
Public Member Functions | |
timer () | |
void | start () |
float | restart () |
void | resume () |
float | stop () |
float | last_time () const |
Time since the last resume() or start(). | |
float | total_time () const |
Total time elapsed. |
Definition at line 39 of file timer.hh.
|
Constructor.
Definition at line 47 of file timer.hh.
00048 { 00049 status_ = e_unknown; 00050 total_time_ = 0; 00051 start_time_ = clock(); 00052 } |
|
Restart the timer.
Definition at line 72 of file timer.hh. References start(), and total_time().
00073 { 00074 assertion(status_ != e_unknown); 00075 float val = total_time(); 00076 start(); 00077 return val; 00078 } |
|
Resume the timer.
Definition at line 85 of file timer.hh.
00086 { 00087 assertion(status_ == e_stopped); 00088 status_ = e_running; 00089 start_time_ = clock(); 00090 } |
|
Start the timer.
Definition at line 59 of file timer.hh. Referenced by restart().
00060 { 00061 assertion(status_ != e_running); 00062 total_time_ = 0; 00063 stop_time_ = 0; 00064 status_ = e_running; 00065 start_time_ = clock(); 00066 } |
|
Stop the timer.
Definition at line 97 of file timer.hh. References total_time().
00098 { 00099 assertion(status_ == e_running); 00100 stop_time_ = clock(); 00101 total_time_ += (stop_time_ - start_time_); 00102 status_ = e_stopped; 00103 return total_time(); 00104 } |