A time watcher can be used to perform and report time measures.
More...
#include <TimeWatcher.h>
|
| TimeWatcher () |
| Instantiate a time watcher.
|
|
void | start () |
| Start the time watcher, which sets the starting point for a time measure.
|
|
void | stop () |
| Stop the time watcher, which sets the ending point for a time measure.
|
|
std::shared_ptr< std::chrono::high_resolution_clock::duration > | getElapsedTime () |
| Obtain the elapsed time as the difference between the last start() and the last stop() invocations. More...
|
|
double | getElapsedDecimalSeconds () |
| Obtain the elapsed time as the real number of seconds. More...
|
|
long | getElapsedSeconds () |
| Obtain the elapsed time as the integer number of seconds. More...
|
|
long | getElapsedMillis () |
| Obtain the elapsed time as the integer number of milliseconds. More...
|
|
long | getElapsedNanos () |
| Obtain the elapsed time as the integer number of nanoseconds. More...
|
|
std::string | getElapsedFormat () |
| Obtain the elapsed time as a string with format "HH:MM:SS". More...
|
|
void | reportSeconds (std::string msg="Total elapsed seconds: ") |
| Report elapsed seconds through specified output stream. More...
|
|
void | reportMillis (std::string msg="Total elapsed milliseconds: ") |
| Report elapsed seconds through specified output stream. More...
|
|
void | reportFormat (std::string msg="Total elapsed time: ") |
| Report elapsed time through specified output stream using "HH:MM:SS" format. More...
|
|
|
bool | hasNulls () |
| Check if the time watcher has null start or end time points. More...
|
|
|
std::unique_ptr< std::chrono::high_resolution_clock::time_point > | tStart |
| Start time point. More...
|
|
std::unique_ptr< std::chrono::high_resolution_clock::time_point > | tEnd |
| End time point. More...
|
|
A time watcher can be used to perform and report time measures.
- Author
- Alberto M. Esmoris Pena
- Version
- 1.0
◆ getElapsedDecimalSeconds()
double TimeWatcher::getElapsedDecimalSeconds |
( |
| ) |
|
Obtain the elapsed time as the real number of seconds.
- Returns
- Elapsed time in real seconds
◆ getElapsedFormat()
std::string TimeWatcher::getElapsedFormat |
( |
| ) |
|
Obtain the elapsed time as a string with format "HH:MM:SS".
- Returns
- Elapsed time as "HH:MM:SS" string
◆ getElapsedMillis()
long TimeWatcher::getElapsedMillis |
( |
| ) |
|
Obtain the elapsed time as the integer number of milliseconds.
- Returns
- Elapsed time in integer milliseconds
◆ getElapsedNanos()
long TimeWatcher::getElapsedNanos |
( |
| ) |
|
Obtain the elapsed time as the integer number of nanoseconds.
- Returns
- Elapsed time in integer nanoseconds
◆ getElapsedSeconds()
long TimeWatcher::getElapsedSeconds |
( |
| ) |
|
Obtain the elapsed time as the integer number of seconds.
- Returns
- Elapsed time in integer seconds
◆ getElapsedTime()
std::shared_ptr< std::chrono::high_resolution_clock::duration > TimeWatcher::getElapsedTime |
( |
| ) |
|
◆ hasNulls()
bool TimeWatcher::hasNulls |
( |
| ) |
|
|
private |
Check if the time watcher has null start or end time points.
- Returns
- FALSE if the time watcher does not have neither a null start nor end time point. TRUE otherwise.
◆ reportFormat()
void TimeWatcher::reportFormat |
( |
std::string |
msg = "Total elapsed time: " | ) |
|
Report elapsed time through specified output stream using "HH:MM:SS" format.
- Parameters
-
msg | Message to be shown by the report. By default "Total elapsed time: " |
◆ reportMillis()
void TimeWatcher::reportMillis |
( |
std::string |
msg = "Total elapsed milliseconds: " | ) |
|
Report elapsed seconds through specified output stream.
- Parameters
-
msg | Message to be shown by the report. By default "Total elapsed millisecconds: " |
◆ reportSeconds()
void TimeWatcher::reportSeconds |
( |
std::string |
msg = "Total elapsed seconds: " | ) |
|
Report elapsed seconds through specified output stream.
- Parameters
-
msg | Message to be shown by the report. By default "Total elapsed seconds: " |
◆ tEnd
std::unique_ptr<std::chrono::high_resolution_clock::time_point> TimeWatcher::tEnd |
|
private |
◆ tStart
std::unique_ptr<std::chrono::high_resolution_clock::time_point> TimeWatcher::tStart |
|
private |
The documentation for this class was generated from the following files: