1#ifndef STORM_UTILITY_STOPWATCH_H_
2#define STORM_UTILITY_STOPWATCH_H_
16 typedef decltype(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::seconds::zero()).count())
SecondType;
17 typedef decltype(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::milliseconds::zero()).count())
MilisecondType;
18 typedef decltype(std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::nanoseconds::zero()).count())
NanosecondType;
47 void addToTime(std::chrono::nanoseconds timeNanoseconds);
83 std::chrono::nanoseconds accumulatedTime;
89 std::chrono::high_resolution_clock::time_point startOfCurrentMeasurement;
A class that provides convenience operations to display run times.
bool stopped() const
Retrieves whether the watch is stopped.
void addToTime(std::chrono::nanoseconds timeNanoseconds)
Add given time to measured time.
decltype(std::chrono::duration_cast< std::chrono::milliseconds >(std::chrono::milliseconds::zero()).count()) MilisecondType
MilisecondType getTimeInMilliseconds() const
Gets the measured time in milliseconds.
friend std::ostream & operator<<(std::ostream &out, Stopwatch const &stopwatch)
void start()
Start stopwatch (again) and start measuring time.
NanosecondType getTimeInNanoseconds() const
Gets the measured time in nanoseconds.
decltype(std::chrono::duration_cast< std::chrono::seconds >(std::chrono::seconds::zero()).count()) SecondType
void restart()
Reset the stopwatch and immediately start it.
SecondType getTimeInSeconds() const
Gets the measured time in seconds.
void reset()
Reset the stopwatch.
void stop()
Stop stopwatch and add measured time to total time.
decltype(std::chrono::duration_cast< std::chrono::nanoseconds >(std::chrono::nanoseconds::zero()).count()) NanosecondType
void add(Stopwatch const &other)
Adds the value of the (stopped) watch to the accumulated time of this watch.
std::ostream & operator<<(std::ostream &os, Engine const &engine)
Writes the string representation of the given engine to the given stream.