ADTF  3.18.2
cStatistics

Simple statistics. More...

Public Member Functions

 cStatistics ()
 Default constructor.
 
 cStatistics (const tChar *strIdentifier, tInt nLogDelay=5000, const tChar *strIntMask=nullptr, const tChar *strFloatMask=nullptr)
 Creates a new statistics object. More...
 
tVoid Init (const tChar *strIdentifier, tInt nLogDelay=5000, const tChar *strIntMask=nullptr, const tChar *strFloatMask=nullptr)
 (Re)initializes a statistics object. More...
 
tVoid Reset ()
 Resets all statistics. More...
 
tVoid Update (tInt nCount=1)
 Adds new events to the object. More...
 
tBool IsUpdated ()
 Whether or not events have already occured. More...
 
tInt GetIntValue ()
 Returns the number of recorded events. More...
 
tFloat64 GetFloatValue ()
 Returns the update rate. More...
 

Protected Attributes

tTimeStamp m_nLastUpdateTime
 The last time the statistics were updated.
 
tTimeStamp m_nElapsed
 Elapsed microseconds.
 
tTimeStamp m_nLastLogTime
 The last time the statistics were logged.
 
tInt m_nCounter
 Internal counter.
 
tFloat64 m_fUpdateRate
 Updates per second.
 
tInt m_nUpdates
 Number of updates.
 
cString m_strIdentifier
 Statistics identifier.
 
tTimeStamp m_nLogDelay
 The update rate at which statistics should be printed.
 
cString m_strIntMask
 Printf-style format specification for integer values.
 
cString m_strFloatMask
 Printf-style format specification for floating-point values.
 
tBool m_bUpdated
 "Dirty" flag
 

Detailed Description

Simple statistics.

Definition at line 18 of file statistics.h.

Constructor & Destructor Documentation

◆ cStatistics()

cStatistics ( const tChar strIdentifier,
tInt  nLogDelay = 5000,
const tChar strIntMask = nullptr,
const tChar strFloatMask = nullptr 
)

Creates a new statistics object.

Parameters
strIdentifier[in] The identifier string, default is 'unknown'.
nLogDelay[in] The update rate at which statistics should be printed (milliseconds).
strIntMask[in] printf-style format specification for integer values.
strFloatMask[in] printf-style format specification for floating-point values.
Note
if both strIntMask and strFloatMask are nullptr, the following float mask is used: [s] %0.1f Updates/Sec

Member Function Documentation

◆ GetFloatValue()

tFloat64 GetFloatValue ( )

Returns the update rate.

Returns
The update rate (updates per second).
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ GetIntValue()

tInt GetIntValue ( )

Returns the number of recorded events.

Returns
The number of recorded events.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ Init()

tVoid Init ( const tChar strIdentifier,
tInt  nLogDelay = 5000,
const tChar strIntMask = nullptr,
const tChar strFloatMask = nullptr 
)

(Re)initializes a statistics object.

Parameters
strIdentifier[in] The identifier string, default is 'unknown'.
nLogDelay[in] The update rate at which statistics should be printed.
strIntMask[in] printf-style format specification for integer values.
strFloatMask[in] printf-style format specification for floating-point values.
Returns
void
Note
if both strIntMask and strFloatMask are nullptr, the following float mask is used: [s] %0.1f Updates/Sec

◆ IsUpdated()

tBool IsUpdated ( )

Whether or not events have already occured.

Returns
Whether or not events have already occured.
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ Reset()

tVoid Reset ( )

Resets all statistics.

Returns
void
This method is real-time safe.\nSee @ref page_real_time_safe.\n

◆ Update()

tVoid Update ( tInt  nCount = 1)

Adds new events to the object.

Parameters
nCount[in] How many events have occured.
Returns
void