SLProject 4.0.000
Utils::AverageTiming Class Reference

Singleton timing class for average measurement of different timing blocks in loops. More...

#include <AverageTiming.h>

Inherits std::map< std::string, AverageTimingBlock * >.

Public Member Functions

 AverageTiming ()
 
 ~AverageTiming ()
 

Static Public Member Functions

static void start (const std::string &name)
 start timer for a new or existing block More...
 
static void stop (const std::string &name)
 stop timer for a running block with name More...
 
static float getTime (const std::string &name)
 get time for block with name More...
 
static float getTime (const std::vector< std::string > &names)
 get time for multiple blocks with given names More...
 
static void getTimingMessage (char *m)
 get timings formatted via string More...
 
static AverageTiminginstance ()
 singleton More...
 

Private Member Functions

void doStart (const std::string &name)
 do start timer for a new or existing block More...
 
void doStop (const std::string &name)
 do stop timer for a running block with name More...
 
float doGetTime (const std::string &name)
 do get time for block with name More...
 
float doGetTime (const std::vector< std::string > &names) const
 do get time for multiple blocks with given names More...
 
void doGetTimingMessage (char *m)
 do get timings formatted via string More...
 

Private Attributes

int _averageNumValues = 200
 
int _currentPosV = 0
 
int _currentPosH = 0
 

Detailed Description

Singleton timing class for average measurement of different timing blocks in loops.

Call start("name") to define a new timing block and start timing or start timing of an existing block. Call stop("name") to finish measurement for this block. Define a hierarchy by posV and posH which is used in ui to arrange the measurements. The first found content with posV==0 is used as reference measurement for the percental value.

Constructor & Destructor Documentation

◆ AverageTiming()

Utils::AverageTiming::AverageTiming ( )

◆ ~AverageTiming()

Utils::AverageTiming::~AverageTiming ( )

Member Function Documentation

◆ doGetTime() [1/2]

float Utils::AverageTiming::doGetTime ( const std::string &  name)
private

do get time for block with name

get time for block with name

◆ doGetTime() [2/2]

float Utils::AverageTiming::doGetTime ( const std::vector< std::string > &  names) const
private

do get time for multiple blocks with given names

get time for multiple blocks with given names

◆ doGetTimingMessage()

void Utils::AverageTiming::doGetTimingMessage ( char *  m)
private

do get timings formatted via string

◆ doStart()

void Utils::AverageTiming::doStart ( const std::string &  name)
private

do start timer for a new or existing block

start timer for a new or existing block

◆ doStop()

void Utils::AverageTiming::doStop ( const std::string &  name)
private

do stop timer for a running block with name

stop timer for a running block with name

◆ getTime() [1/2]

float Utils::AverageTiming::getTime ( const std::string &  name)
static

get time for block with name

◆ getTime() [2/2]

float Utils::AverageTiming::getTime ( const std::vector< std::string > &  names)
static

get time for multiple blocks with given names

◆ getTimingMessage()

void Utils::AverageTiming::getTimingMessage ( char *  m)
static

get timings formatted via string

◆ instance()

static AverageTiming & Utils::AverageTiming::instance ( )
inlinestatic

singleton

◆ start()

void Utils::AverageTiming::start ( const std::string &  name)
static

start timer for a new or existing block

◆ stop()

void Utils::AverageTiming::stop ( const std::string &  name)
static

stop timer for a running block with name

Member Data Documentation

◆ _averageNumValues

int Utils::AverageTiming::_averageNumValues = 200
private

◆ _currentPosH

int Utils::AverageTiming::_currentPosH = 0
private

◆ _currentPosV

int Utils::AverageTiming::_currentPosV = 0
private

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