Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::Timer Class Referencefinal

A timer. Measures relative time (not wall clock). More...

#include <Timer.h>

Public Types

using Clock = std::chrono::steady_clock
 
using DefaultTimeUnit = Clock::duration
 

Public Member Functions

 Timer ()
 
Timerstart ()
 Zero and start the timer.
 
TimeraccumulatedStart ()
 Effectively resumes the timer. Start the timer by continuing last result from stop().
 
Timerstop ()
 Stop the timer and record elapsed time.
 
DefaultTimeUnit markLap ()
 Get the time elapsed between calls to markLap(). If this is the first markLap() call, start() and accumulatedStart() are treated as implicit lap marker.
 
DefaultTimeUnit peekLap () const
 Get the time elapsed from last call to markLap(). Get the result of markLap() as if it was called, without actually making a lap mark– the state of the timer is not affected in anyway by this call.
 
DefaultTimeUnit getDelta () const
 Get the time elapsed between start() and stop(). Possibly accumulated. Result may be accumulated if accumulatedStart() was used instead of start().
 
template<typename NumberType = uint64>
NumberType markLapS ()
 Variants that return time in plain number with different units and types. As casting a numeric value across different types, these methods may induce precision loss depending on NumberType. Stick to base methods (the ones without time unit suffix) if numeric precision is important.
 
template<typename NumberType = uint64>
NumberType markLapMs ()
 
template<typename NumberType = uint64>
NumberType markLapUs ()
 
template<typename NumberType = uint64>
NumberType markLapNs ()
 
template<typename NumberType = uint64>
NumberType getDeltaS () const
 
template<typename NumberType = uint64>
NumberType getDeltaMs () const
 
template<typename NumberType = uint64>
NumberType getDeltaUs () const
 
template<typename NumberType = uint64>
NumberType getDeltaNs () const
 

Detailed Description

A timer. Measures relative time (not wall clock).

Member Typedef Documentation

◆ Clock

using ph::Timer::Clock = std::chrono::steady_clock

◆ DefaultTimeUnit

using ph::Timer::DefaultTimeUnit = Clock::duration

Constructor & Destructor Documentation

◆ Timer()

ph::Timer::Timer ( )
inline

Member Function Documentation

◆ accumulatedStart()

Timer & ph::Timer::accumulatedStart ( )
inline

Effectively resumes the timer. Start the timer by continuing last result from stop().

◆ getDelta()

Timer::DefaultTimeUnit ph::Timer::getDelta ( ) const
inline

Get the time elapsed between start() and stop(). Possibly accumulated. Result may be accumulated if accumulatedStart() was used instead of start().

◆ getDeltaMs()

template<typename NumberType >
NumberType ph::Timer::getDeltaMs ( ) const
inline

◆ getDeltaNs()

template<typename NumberType >
NumberType ph::Timer::getDeltaNs ( ) const
inline

◆ getDeltaS()

template<typename NumberType >
NumberType ph::Timer::getDeltaS ( ) const
inline

◆ getDeltaUs()

template<typename NumberType >
NumberType ph::Timer::getDeltaUs ( ) const
inline

◆ markLap()

Timer::DefaultTimeUnit ph::Timer::markLap ( )
inline

Get the time elapsed between calls to markLap(). If this is the first markLap() call, start() and accumulatedStart() are treated as implicit lap marker.

◆ markLapMs()

template<typename NumberType >
NumberType ph::Timer::markLapMs ( )
inline

◆ markLapNs()

template<typename NumberType >
NumberType ph::Timer::markLapNs ( )
inline

◆ markLapS()

template<typename NumberType >
NumberType ph::Timer::markLapS ( )
inline

Variants that return time in plain number with different units and types. As casting a numeric value across different types, these methods may induce precision loss depending on NumberType. Stick to base methods (the ones without time unit suffix) if numeric precision is important.

◆ markLapUs()

template<typename NumberType >
NumberType ph::Timer::markLapUs ( )
inline

◆ peekLap()

Timer::DefaultTimeUnit ph::Timer::peekLap ( ) const
inline

Get the time elapsed from last call to markLap(). Get the result of markLap() as if it was called, without actually making a lap mark– the state of the timer is not affected in anyway by this call.

◆ start()

Timer & ph::Timer::start ( )
inline

Zero and start the timer.

◆ stop()

Timer & ph::Timer::stop ( )
inline

Stop the timer and record elapsed time.


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