Cogs.Core
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
Cogs::Timer Class Reference

High-resolution performance timer. More...

#include <Timer.h>

Public Member Functions

void start ()
 
void stop ()
 
int64_t elapsedMicroseconds ()
 
int64_t elapsedMilliseconds ()
 
double elapsedSeconds ()
 
void setScale (int64_t s)
 
void resetScale ()
 
int64_t getScale () const
 
TimePerf scalePerfTime (TimePerf time)
 

Static Public Member Functions

static Timer startNew ()
 
static int64_t currentTimeMicroseconds ()
 
static int64_t currentTimeMilliseconds ()
 

Private Attributes

TimePerf startTime = {}
 
TimePerf stopTime = {}
 
int64_t scale = 1000
 
bool running = false
 

Detailed Description

High-resolution performance timer.

Example:

auto timer = Cogs::Timer::startNew();
// ... do work ...
double elapsed = timer.elapsedSeconds();

Definition at line 45 of file Timer.h.

Member Function Documentation

◆ currentTimeMicroseconds()

static int64_t Cogs::Timer::currentTimeMicroseconds ( )
inlinestatic

Definition at line 70 of file Timer.h.

◆ currentTimeMilliseconds()

static int64_t Cogs::Timer::currentTimeMilliseconds ( )
inlinestatic

Definition at line 71 of file Timer.h.

◆ elapsedMicroseconds()

int64_t Cogs::Timer::elapsedMicroseconds ( )
inline

Definition at line 66 of file Timer.h.

◆ elapsedMilliseconds()

int64_t Cogs::Timer::elapsedMilliseconds ( )
inline

Definition at line 67 of file Timer.h.

◆ elapsedSeconds()

double Cogs::Timer::elapsedSeconds ( )
inline

Definition at line 68 of file Timer.h.

◆ getScale()

int64_t Cogs::Timer::getScale ( ) const
inline

Definition at line 81 of file Timer.h.

◆ resetScale()

void Cogs::Timer::resetScale ( )
inline

Definition at line 80 of file Timer.h.

◆ scalePerfTime()

TimePerf Cogs::Timer::scalePerfTime ( TimePerf  time)
inline

Definition at line 82 of file Timer.h.

◆ setScale()

void Cogs::Timer::setScale ( int64_t  s)
inline

Definition at line 79 of file Timer.h.

◆ start()

void Cogs::Timer::start ( )
inline

Definition at line 55 of file Timer.h.

◆ startNew()

static Timer Cogs::Timer::startNew ( )
inlinestatic

Definition at line 48 of file Timer.h.

◆ stop()

void Cogs::Timer::stop ( )
inline

Definition at line 60 of file Timer.h.

Member Data Documentation

◆ running

bool Cogs::Timer::running = false
private

Definition at line 93 of file Timer.h.

◆ scale

int64_t Cogs::Timer::scale = 1000
private

Definition at line 91 of file Timer.h.

◆ startTime

TimePerf Cogs::Timer::startTime = {}
private

Definition at line 86 of file Timer.h.

◆ stopTime

TimePerf Cogs::Timer::stopTime = {}
private

Definition at line 87 of file Timer.h.


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