Overte C++ Documentation
gpu::RangeTimer Class Reference

#include <Query.h>

Public Member Functions

void begin (gpu::Batch &batch)
 Adds a batch command to begin query. More...
 
void end (gpu::Batch &batch)
 Adds a batch command to get query. More...
 
double getGPUAverage () const
 
double getBatchAverage () const
 
const std::string & name () const
 

Protected Member Functions

int rangeIndex (int index) const
 Calculates index in the circular buffer where the queries are stored.
 

Protected Attributes

const std::string _name
 Name of the range timer.
 
gpu::Queries _timerQueries
 Query objects used for this range timer.
 
int _headIndex = -1
 Used for circular buffer. Index of the last query that was executed can be calculated from this using rangeIndex().
 
int _tailIndex = -1
 
MovingAverage< double, QUERY_QUEUE_SIZE *2 > _movingAverageGPU
 Average of the time measured on GPU in millseconds.
 
MovingAverage< double, QUERY_QUEUE_SIZE *2 > _movingAverageBatch
 Average of the time between do_beginQuery and do_endQuery measured when the batch is executed.
 

Static Protected Attributes

static const int QUERY_QUEUE_SIZE { 4 }
 Number of query objects in this range timer.
 

Detailed Description

gpu RangeTimer is just returning an estimate of the time taken by a chunk of work delimited by the begin and end calls repeated for several times. The result is always a late average of the time spent for that same task a few cycles ago.

Member Function Documentation

◆ begin()

void RangeTimer::begin ( gpu::Batch &  batch)

Adds a batch command to begin query.

Parameters
batchBatch to add the command to.

◆ end()

void RangeTimer::end ( gpu::Batch &  batch)

Adds a batch command to get query.

Parameters
batchBatch to add the command to.

◆ getBatchAverage()

double RangeTimer::getBatchAverage ( ) const

Batch time is time measured between do_beginQuery and do_endQuery.

Returns
Get batch average time in milliseconds.

◆ getGPUAverage()

double RangeTimer::getGPUAverage ( ) const
Returns
Get GPU average time in milliseconds.

◆ name()

const std::string& gpu::RangeTimer::name ( ) const
inline
Returns
Name of this range timer.

Member Data Documentation

◆ _tailIndex

int gpu::RangeTimer::_tailIndex = -1
protected

Used for circular buffer. Index of the last query that was executed can be calculated from this using rangeIndex(). Incremented by a Query object when it's ready for reading.


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