90 std::shared_ptr<std::chrono::high_resolution_clock::duration>
123 std::string msg =
"Total elapsed seconds: "
132 std::string msg =
"Total elapsed milliseconds: "
142 std::string msg =
"Total elapsed time: "
160 std::unique_ptr<std::chrono::high_resolution_clock::time_point>
tStart;
166 std::unique_ptr<std::chrono::high_resolution_clock::time_point>
tEnd;
176 std::unique_ptr<std::chrono::high_resolution_clock::time_point>
savedStart;
193 std::unique_ptr<std::chrono::high_resolution_clock::time_point>
195 std::unique_ptr<std::chrono::high_resolution_clock::time_point>
const
A time watcher can be used to perform and report time measures.
Definition: TimeWatcher.h:13
std::unique_ptr< std::chrono::high_resolution_clock::time_point > tStart
Start time point.
Definition: TimeWatcher.h:160
void startIfNull()
Start the time watcher but only if it has not been started before. Previous start might come either f...
Definition: TimeWatcher.cpp:22
void saveStart()
Save the start time to local cache.
Definition: TimeWatcher.cpp:40
std::unique_ptr< std::chrono::high_resolution_clock::time_point > savedStart
Used to store a temporary copy of current tStart.
Definition: TimeWatcher.h:176
bool hasNulls()
Check if the time watcher has null start or end time points.
Definition: TimeWatcher.cpp:115
void syncTimePoints(std::unique_ptr< std::chrono::high_resolution_clock::time_point > &p, std::unique_ptr< std::chrono::high_resolution_clock::time_point > const &q)
Synchronize time point with time point .
Definition: TimeWatcher.cpp:119
void loadStart()
Load the start time from local cache.
Definition: TimeWatcher.cpp:43
bool hasStarted() const
Check if time watcher has been started.
Definition: TimeWatcher.cpp:28
void reportFormat(std::string msg="Total elapsed time: ")
Report elapsed time through specified output stream using "HH:MM:SS" format.
Definition: TimeWatcher.cpp:101
void reportSeconds(std::string msg="Total elapsed seconds: ")
Report elapsed seconds through specified output stream.
Definition: TimeWatcher.cpp:89
std::string getElapsedFormat()
Obtain the elapsed time as a string with format "HH:MM:SS".
Definition: TimeWatcher.cpp:76
void synchronize(TimeWatcher const &source)
Synchronizes start, end and saved start times with those of given source.
Definition: TimeWatcher.cpp:107
void stop()
Stop the time watcher, which sets the ending point for a time measure.
Definition: TimeWatcher.cpp:32
long getElapsedNanos()
Obtain the elapsed time as the integer number of nanoseconds.
Definition: TimeWatcher.cpp:69
void releaseStart()
Release stored start so it is null.
Definition: TimeWatcher.cpp:25
void reportMillis(std::string msg="Total elapsed milliseconds: ")
Report elapsed seconds through specified output stream.
Definition: TimeWatcher.cpp:95
long getElapsedMillis()
Obtain the elapsed time as the integer number of milliseconds.
Definition: TimeWatcher.cpp:63
void start()
Start the time watcher, which sets the starting point for a time measure.
Definition: TimeWatcher.cpp:15
std::unique_ptr< std::chrono::high_resolution_clock::time_point > tEnd
End time point.
Definition: TimeWatcher.h:166
TimeWatcher()
Instantiate a time watcher.
Definition: TimeWatcher.cpp:8
long getElapsedSeconds()
Obtain the elapsed time as the integer number of seconds.
Definition: TimeWatcher.cpp:57
double getElapsedDecimalSeconds()
Obtain the elapsed time as the real number of seconds.
Definition: TimeWatcher.cpp:54
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.
Definition: TimeWatcher.cpp:48