Inviwo  0.9.10.1
Inviwo documentation
inviwo::Clock Class Reference

#include <clock.h>

+ Inheritance diagram for inviwo::Clock:

Public Types

using clock = std::chrono::high_resolution_clock
 
using duration = std::chrono::high_resolution_clock::duration
 
using time_point = std::chrono::high_resolution_clock::time_point
 

Public Member Functions

 Clock ()
 
bool isRunning () const
 
void start ()
 
void stop ()
 
void reset ()
 
duration getElapsedTime () const
 
double getElapsedMilliseconds () const
 
double getElapsedSeconds () const
 

Protected Attributes

bool isRunning_ = false
 
time_point startTime_
 
duration accumulatedTime_ = static_cast<duration>(0)
 

Detailed Description

Clock for measuring elapsed time between a start and stop point. The clock accumulates the elapsed times when start and stop are called multiple times.

Constructor & Destructor Documentation

◆ Clock()

inviwo::Clock::Clock ( )

creates a clock and starts it

Member Function Documentation

◆ getElapsedMilliseconds()

double inviwo::Clock::getElapsedMilliseconds ( ) const

returns the accumulated time. If the clock is running the result is accumulated time plus the current elapsed time.

Returns
accumulated time in milliseconds
See also
getElapsedTime

◆ getElapsedSeconds()

double inviwo::Clock::getElapsedSeconds ( ) const

returns the accumulated time. If the clock is running the result is accumulated time plus the current elapsed time.

Returns
accumulated time in seconds
See also
getElapsedTime

◆ getElapsedTime()

auto inviwo::Clock::getElapsedTime ( ) const

returns the accumulated time. If the clock is running the result is accumulated time plus the current elapsed time.

Returns
accumulated time

◆ isRunning()

bool inviwo::Clock::isRunning ( ) const

query whether the clock has been started

Returns
true if the clock is running

◆ reset()

void inviwo::Clock::reset ( )

resets the accumulated time to 0

◆ start()

void inviwo::Clock::start ( )

starts the clock

◆ stop()

void inviwo::Clock::stop ( )

stops the clock and accumulates the elapsed time since start() was called


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