JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
Public Member Functions | Protected Member Functions | Protected Attributes
Timer Class Reference

#include <Timer.h>

Public Member Functions

 Timer ()
 
void start ()
 
void stop ()
 
double durationSeconds ()
 
std::string toString ()
 
void log (const std::string &what, const std::string &part)
 
std::string toHumanDuration () const
 

Protected Member Functions

std::chrono::time_point< std::chrono::system_clock > now ()
 

Protected Attributes

std::chrono::time_point< std::chrono::system_clock > startTime
 
std::chrono::time_point< std::chrono::system_clock > endTime
 

Detailed Description

A timer that can be started and stopped multiple times and replaces the previous runtime.

Constructor & Destructor Documentation

◆ Timer()

Timer::Timer ( )

Creates a new instance of the timer and immediately starts it.

Here is the call graph for this function:

Member Function Documentation

◆ durationSeconds()

double Timer::durationSeconds ( )

Returns the total duration of the timer in seconds.

Returns
the total duration of the timer in seconds.
Here is the caller graph for this function:

◆ log()

void Timer::log ( const std::string &  what,
const std::string &  part 
)

Loggs the runtime to GLOG with an string tag and description "[<part>] <what> took <time>"

Parameters
whatthe description of what was measured
whatthe description of what was measured
Here is the call graph for this function:
Here is the caller graph for this function:

◆ now()

std::chrono::time_point< std::chrono::system_clock > Timer::now ( )
protected
Here is the caller graph for this function:

◆ start()

void Timer::start ( )

Start the timer, the previous runtime (if exists) is replaced.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop()

void Timer::stop ( )

Stopps the timer

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toHumanDuration()

std::string Timer::toHumanDuration ( ) const

Creates a human readable string representation of the duration in the format: "xh xm xs xms"

Returns
human readable string representation of the duration
Here is the caller graph for this function:

◆ toString()

std::string Timer::toString ( )

Creates a string representation of the duration

Returns
string representation of the duration

Field Documentation

◆ endTime

std::chrono::time_point<std::chrono::system_clock> Timer::endTime
protected

◆ startTime

std::chrono::time_point<std::chrono::system_clock> Timer::startTime
protected

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