OpenSceneGraph 3.6.5
osg::Timer Class Reference

Timer class is used for measuring elapsed time or time between two points. More...

#include <Timer>

Public Member Functions

 Timer ()
 ~Timer ()
Timer_t tick () const
 Get the timers tick value.
void setStartTick ()
 Set the start.
void setStartTick (Timer_t t)
Timer_t getStartTick () const
double time_s () const
 Get elapsed time in seconds.
double time_m () const
 Get elapsed time in milliseconds.
double time_u () const
 Get elapsed time in microseconds.
double time_n () const
 Get elapsed time in nanoseconds.
double delta_s (Timer_t t1, Timer_t t2) const
 Get the time in seconds between timer ticks t1 and t2.
double delta_m (Timer_t t1, Timer_t t2) const
 Get the time in milliseconds between timer ticks t1 and t2.
double delta_u (Timer_t t1, Timer_t t2) const
 Get the time in microseconds between timer ticks t1 and t2.
double delta_n (Timer_t t1, Timer_t t2) const
 Get the time in nanoseconds between timer ticks t1 and t2.
double getSecondsPerTick () const
 Get the number of seconds per tick.

Static Public Member Functions

static Timerinstance ()

Protected Attributes

Timer_t _startTick
double _secsPerTick

Detailed Description

Timer class is used for measuring elapsed time or time between two points.

Constructor & Destructor Documentation

◆ Timer()

osg::Timer::Timer ( )

Referenced by instance().

◆ ~Timer()

osg::Timer::~Timer ( )
inline

Member Function Documentation

◆ delta_m()

double osg::Timer::delta_m ( Timer_t t1,
Timer_t t2 ) const
inline

Get the time in milliseconds between timer ticks t1 and t2.

References delta_s().

Referenced by time_m().

◆ delta_n()

double osg::Timer::delta_n ( Timer_t t1,
Timer_t t2 ) const
inline

Get the time in nanoseconds between timer ticks t1 and t2.

References delta_s().

Referenced by time_n().

◆ delta_s()

double osg::Timer::delta_s ( Timer_t t1,
Timer_t t2 ) const
inline

Get the time in seconds between timer ticks t1 and t2.

References _secsPerTick.

Referenced by delta_m(), delta_n(), delta_u(), osg::State::getGpuTime(), osgGA::EventQueue::getTime(), osg::GraphicsContext::getTimeSinceLastClear(), and time_s().

◆ delta_u()

double osg::Timer::delta_u ( Timer_t t1,
Timer_t t2 ) const
inline

Get the time in microseconds between timer ticks t1 and t2.

References delta_s().

Referenced by time_u().

◆ getSecondsPerTick()

double osg::Timer::getSecondsPerTick ( ) const
inline

Get the number of seconds per tick.

References _secsPerTick.

◆ getStartTick()

Timer_t osg::Timer::getStartTick ( ) const
inline

References _startTick.

◆ instance()

◆ setStartTick() [1/2]

void osg::Timer::setStartTick ( )
inline

Set the start.

References _startTick, and tick().

◆ setStartTick() [2/2]

void osg::Timer::setStartTick ( Timer_t t)
inline

References _startTick.

◆ tick()

Timer_t osg::Timer::tick ( ) const

Get the timers tick value.

Referenced by setStartTick(), time_m(), time_n(), time_s(), and time_u().

◆ time_m()

double osg::Timer::time_m ( ) const
inline

Get elapsed time in milliseconds.

References _startTick, delta_m(), and tick().

◆ time_n()

double osg::Timer::time_n ( ) const
inline

Get elapsed time in nanoseconds.

References _startTick, delta_n(), and tick().

◆ time_s()

double osg::Timer::time_s ( ) const
inline

Get elapsed time in seconds.

References _startTick, delta_s(), and tick().

◆ time_u()

double osg::Timer::time_u ( ) const
inline

Get elapsed time in microseconds.

References _startTick, delta_u(), and tick().

Member Data Documentation

◆ _secsPerTick

double osg::Timer::_secsPerTick
protected

Referenced by delta_s(), and getSecondsPerTick().

◆ _startTick

Timer_t osg::Timer::_startTick
protected

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

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.