Candy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Candy::TimeStatistics Class Reference

TimeStatistics is a tool for measuring frame rates in different threads, thread contention and algorithm delay. More...

Inheritance diagram for Candy::TimeStatistics:
Inheritance graph
[legend]

Public Member Functions

 TimeStatistics (H3D::Inst< H3D::SFNode > _metadata=0, H3D::Inst< H3D::MFString > _identifier=0, H3D::Inst< H3D::MFFloat > _secondsPerTick=0, H3D::Inst< H3D::MFFloat > _ticksPerSecond=0, H3D::Inst< H3D::MFFloat > _fractionTicktock=0, H3D::Inst< H3D::SFFloat > _statisticsWindow=0, H3D::Inst< H3D::SFString > _tickIdentifier=0, H3D::Inst< H3D::SFString > _tockIdentifier=0, H3D::Inst< TickField > _tickField=0, H3D::Inst< TockField > _tockField=0)
 
void traverseSG (H3D::TraverseInfo &ti)
 

Static Public Member Functions

static void tick (void *ptr, const std::string &identifier)
 Call this function to get a measure of how often the part of the code is reached. More...
 
static void tock (void *ptr, const std::string &identifier)
 Call this function after a tick to get a measure of how much of the time between two ticks is spent between a tick and a tock. More...
 
static void getData (std::vector< std::string > &identifiers, std::vector< float > &timePerTick, std::vector< float > &fractionTicktock)
 Esimates and returns the time statistics. More...
 

Public Attributes

std::auto_ptr< H3D::MFStringidentifier
  (output only) The key used to identify each time statistics. More...
 
std::auto_ptr< H3D::MFFloatsecondsPerTick
  (output only) The time elapsed between ticks, expressed in seconds. More...
 
std::auto_ptr< H3D::MFFloatticksPerSecond
  (output only) The number of ticks per second, estimated as one over the secondsPerTick value. More...
 
std::auto_ptr< H3D::MFFloatfractionTicktock
  (output only) The fraction of the total time between a tick and the next tick that is spent between the tick and the tock. More...
 
std::auto_ptr< H3D::SFFloatstatisticsWindow
  (input/output) The window over which the statistics are averaged, expressed in seconds. More...
 
std::auto_ptr< H3D::SFStringtickIdentifier
  (input only) This field is connected to the tick function. More...
 
std::auto_ptr< H3D::SFStringtockIdentifier
  (input only) This field is connected to the tock function. More...
 

Static Public Attributes

static H3D::H3DNodeDatabase database
 

Detailed Description

TimeStatistics is a tool for measuring frame rates in different threads, thread contention and algorithm delay.

It is thread safe and called through static functions, and the actual data are estimated upon every call to traverseSG.

Member Function Documentation

static void Candy::TimeStatistics::getData ( std::vector< std::string > &  identifiers,
std::vector< float > &  timePerTick,
std::vector< float > &  fractionTicktock 
)
inlinestatic

Esimates and returns the time statistics.

The data are cached and updated only if a call to tick or tock has been made since the last call.

static void Candy::TimeStatistics::tick ( void *  ptr,
const std::string &  identifier 
)
inlinestatic

Call this function to get a measure of how often the part of the code is reached.

Use each identifier only once to get an accurate result. The 'this' pointer should be provided as a means to differentiate between calls made from different instances of the same code.

static void Candy::TimeStatistics::tock ( void *  ptr,
const std::string &  identifier 
)
inlinestatic

Call this function after a tick to get a measure of how much of the time between two ticks is spent between a tick and a tock.

Use each identifier only once to get an accurate result. The 'this' pointer should be provided as a means to differentiate between calls made from different instances of the same code.

Member Data Documentation

std::auto_ptr<H3D::MFFloat> Candy::TimeStatistics::fractionTicktock

(output only) The fraction of the total time between a tick and the next tick that is spent between the tick and the tock.

If tick and tock surrounds a computationally heavy algorithm, this measure tells how much of the frame-time that is spent by that algorithm.

std::auto_ptr<H3D::MFString> Candy::TimeStatistics::identifier

(output only) The key used to identify each time statistics.

std::auto_ptr<H3D::MFFloat> Candy::TimeStatistics::secondsPerTick

(output only) The time elapsed between ticks, expressed in seconds.

This value is averaged over the specified window.

std::auto_ptr<H3D::SFFloat> Candy::TimeStatistics::statisticsWindow

(input/output) The window over which the statistics are averaged, expressed in seconds.

The default value is one second.

std::auto_ptr<H3D::SFString> Candy::TimeStatistics::tickIdentifier

(input only) This field is connected to the tick function.

See ::tick for more information.

std::auto_ptr<H3D::MFFloat> Candy::TimeStatistics::ticksPerSecond

(output only) The number of ticks per second, estimated as one over the secondsPerTick value.

std::auto_ptr<H3D::SFString> Candy::TimeStatistics::tockIdentifier

(input only) This field is connected to the tock function.

See ::tock for more information.