This class keeps track of the system elapsed time and the CPU clock counter.
More...
#include <TimeTracker.hpp>
List of all members.
Public Member Functions |
| TimeTracker (string _name) |
| Constructor.
|
void | start () |
| Starts this tracker.
|
void | pause () |
| Pause the tracking temporarily.
|
void | resume () |
| Resume the tracking.
|
long double | end () |
| Finish this tracker.
|
long double | elapsedTime () |
| Return the elapsed time based on the system time.
|
long double | workSpent () |
| Return the work spent based on the CPU clock.
|
void | reset () |
| Reset all counters and the tracker state.
|
string | getName () |
| Return the name of this tracker.
|
void | print (void) |
| Print the tracker to the output stream.
|
void | print (ostringstream *out) |
| Print the tracker to the stream provided.
|
void | sumWork (TimeTracker *tt) |
| Sum the current work with the parameter's work.
|
void | sumTime (TimeTracker *tt) |
| Sum the current elapsed time with the parameter's elapsed time.
|
void | sum (TimeTracker *tt) |
| Sum this tracker with the parameter.
|
Detailed Description
This class keeps track of the system elapsed time and the CPU clock counter.
Constructor & Destructor Documentation
TimeTracker::TimeTracker |
( |
string |
_name | ) |
|
Constructor.
- Parameters:
-
_name | The name of this tracker. |
Member Function Documentation
long double TimeTracker::elapsedTime |
( |
| ) |
|
Return the elapsed time based on the system time.
The elapsed time is calculated as the difference between the tracker start and: either the last call of pause method or the call of the end method.
- Returns:
- Current elapsed time.
long double TimeTracker::end |
( |
| ) |
|
Finish this tracker.
- Returns:
- The total elapsed time.
string TimeTracker::getName |
( |
| ) |
[inline] |
Return the name of this tracker.
- Returns:
- The name of this tracker.
void TimeTracker::print |
( |
ostringstream * |
out | ) |
|
Print the tracker to the stream provided.
- Parameters:
-
out | The stream to be used for the printing. |
Sum this tracker with the parameter.
- Parameters:
-
tt | The tracker instance to be added to the current tracker. |
Sum the current elapsed time with the parameter's elapsed time.
- Parameters:
-
tt | The tracker instance to be added to the current elapsed time. |
Sum the current work with the parameter's work.
- Parameters:
-
tt | The tracker instance to be added to the current work. |
long double TimeTracker::workSpent |
( |
| ) |
|
Return the work spent based on the CPU clock.
- Returns:
- Current work spent.
The documentation for this class was generated from the following files:
- TimeTracker.hpp
- TimeTracker.cpp