AutoPas  3.0.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
autopas::utils::Timer Class Reference

Timer class to stop times. More...

#include <Timer.h>

Public Member Functions

void start ()
 start the timer.
 
long stop ()
 Stops the timer and returns the time elapsed in nanoseconds since the last call to start.
 
void reset ()
 Resets the timer to 0.
 
void addTime (long nanoseconds)
 Adds the given amount of nanoseconds to the total time.
 
long getTotalTime () const
 Get total accumulated time.
 

Static Public Member Functions

static std::string getDateStamp (const std::string &format="%Y-%m-%d_%H-%M-%S")
 Create a date stamp for the current moment with the given format.
 

Detailed Description

Timer class to stop times.

Member Function Documentation

◆ addTime()

void autopas::utils::Timer::addTime ( long  nanoseconds)

Adds the given amount of nanoseconds to the total time.

Parameters
nanoseconds

◆ getDateStamp()

static std::string autopas::utils::Timer::getDateStamp ( const std::string &  format = "%Y-%m-%d_%H-%M-%S")
inlinestatic

Create a date stamp for the current moment with the given format.

Parameters
formatDate stamp format.
Returns
String representation of the current date in the given format.

◆ getTotalTime()

long autopas::utils::Timer::getTotalTime ( ) const
inline

Get total accumulated time.

Returns
Total time in nano seconds.

◆ stop()

long autopas::utils::Timer::stop ( )

Stops the timer and returns the time elapsed in nanoseconds since the last call to start.

It also adds the duration to the total time.

Returns
elapsed time in nanoseconds

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