Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
storm::utility::Stopwatch Class Reference

A class that provides convenience operations to display run times. More...

#include <Stopwatch.h>

Public Types

typedef decltype(std::chrono::duration_cast< std::chrono::seconds >(std::chrono::seconds::zero()).count()) SecondType
 
typedef decltype(std::chrono::duration_cast< std::chrono::milliseconds >(std::chrono::milliseconds::zero()).count()) MilisecondType
 
typedef decltype(std::chrono::duration_cast< std::chrono::nanoseconds >(std::chrono::nanoseconds::zero()).count()) NanosecondType
 

Public Member Functions

 Stopwatch (bool startNow=false)
 Constructor.
 
SecondType getTimeInSeconds () const
 Gets the measured time in seconds.
 
MilisecondType getTimeInMilliseconds () const
 Gets the measured time in milliseconds.
 
NanosecondType getTimeInNanoseconds () const
 Gets the measured time in nanoseconds.
 
void addToTime (std::chrono::nanoseconds timeNanoseconds)
 Add given time to measured time.
 
void add (Stopwatch const &other)
 Adds the value of the (stopped) watch to the accumulated time of this watch.
 
void stop ()
 Stop stopwatch and add measured time to total time.
 
void start ()
 Start stopwatch (again) and start measuring time.
 
void reset ()
 Reset the stopwatch.
 
void restart ()
 Reset the stopwatch and immediately start it.
 
bool stopped () const
 Retrieves whether the watch is stopped.
 

Friends

std::ostream & operator<< (std::ostream &out, Stopwatch const &stopwatch)
 

Detailed Description

A class that provides convenience operations to display run times.

Definition at line 14 of file Stopwatch.h.

Member Typedef Documentation

◆ MilisecondType

typedef decltype(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::milliseconds::zero()).count()) storm::utility::Stopwatch::MilisecondType

Definition at line 17 of file Stopwatch.h.

◆ NanosecondType

typedef decltype(std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::nanoseconds::zero()).count()) storm::utility::Stopwatch::NanosecondType

Definition at line 18 of file Stopwatch.h.

◆ SecondType

typedef decltype(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::seconds::zero()).count()) storm::utility::Stopwatch::SecondType

Definition at line 16 of file Stopwatch.h.

Constructor & Destructor Documentation

◆ Stopwatch()

storm::utility::Stopwatch::Stopwatch ( bool  startNow = false)

Constructor.

Parameters
startNowIf true, the stopwatch starts right away.

Definition at line 6 of file Stopwatch.cpp.

Member Function Documentation

◆ add()

void storm::utility::Stopwatch::add ( Stopwatch const &  other)

Adds the value of the (stopped) watch to the accumulated time of this watch.

Definition at line 37 of file Stopwatch.cpp.

◆ addToTime()

void storm::utility::Stopwatch::addToTime ( std::chrono::nanoseconds  timeNanoseconds)

Add given time to measured time.

Parameters
timeNanosecondsAdditional time in nanoseconds.

Definition at line 33 of file Stopwatch.cpp.

◆ getTimeInMilliseconds()

Stopwatch::MilisecondType storm::utility::Stopwatch::getTimeInMilliseconds ( ) const

Gets the measured time in milliseconds.

Definition at line 21 of file Stopwatch.cpp.

◆ getTimeInNanoseconds()

Stopwatch::NanosecondType storm::utility::Stopwatch::getTimeInNanoseconds ( ) const

Gets the measured time in nanoseconds.

Definition at line 29 of file Stopwatch.cpp.

◆ getTimeInSeconds()

Stopwatch::SecondType storm::utility::Stopwatch::getTimeInSeconds ( ) const

Gets the measured time in seconds.

Definition at line 13 of file Stopwatch.cpp.

◆ reset()

void storm::utility::Stopwatch::reset ( )

Reset the stopwatch.

Definition at line 54 of file Stopwatch.cpp.

◆ restart()

void storm::utility::Stopwatch::restart ( )

Reset the stopwatch and immediately start it.

Definition at line 59 of file Stopwatch.cpp.

◆ start()

void storm::utility::Stopwatch::start ( )

Start stopwatch (again) and start measuring time.

Definition at line 48 of file Stopwatch.cpp.

◆ stop()

void storm::utility::Stopwatch::stop ( )

Stop stopwatch and add measured time to total time.

Definition at line 42 of file Stopwatch.cpp.

◆ stopped()

bool storm::utility::Stopwatch::stopped ( ) const

Retrieves whether the watch is stopped.

Definition at line 64 of file Stopwatch.cpp.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
Stopwatch const &  stopwatch 
)
friend

Definition at line 68 of file Stopwatch.cpp.


The documentation for this class was generated from the following files: