ADTF  3.18.2
statistics.h
Go to the documentation of this file.
1 
7 #ifndef _STATISTICS_FUNCTIONS_HEADER_
8 #define _STATISTICS_FUNCTIONS_HEADER_
9 
10 namespace A_UTILS_NS
11 {
12 
18 class DOEXPORT cStatistics
19 {
21 
22  protected:
29 
32 
35 
37 
38  public:
43 
52  cStatistics(const tChar* strIdentifier,
53  tInt nLogDelay=5000,
54  const tChar* strIntMask=nullptr,
55  const tChar* strFloatMask=nullptr);
56 
57 
67  tVoid Init(const tChar* strIdentifier,
68  tInt nLogDelay=5000,
69  const tChar* strIntMask=nullptr,
70  const tChar* strFloatMask=nullptr);
71 
78 
84  tVoid Update(tInt nCount=1);
85 
92 
105 };
106 
110 #define __a_util_declare_statistics(id) static A_UTILS_NS::cStatistics _g_local_Statistics(id)
111 
115 #define __declare_statistics(id) __a_util_declare_statistics(id)
116 
121 #define __a_util_reset_statistics _g_local_Statistics.Reset()
122 
126 #define __reset_statistics __a_util_reset_statistics
127 
132 #define __a_util_update_statistics _g_local_Statistics.Update()
133 
137 #define __update_statistics __a_util_update_statistics
138 
139 } // namespace
140 
141 #endif // _STATISTICS_FUNCTIONS_HEADER_
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
void tVoid
The tVoid is always the definition for the void (non-type).
int tInt
type definition for signed integer value (platform and compiler dependent type).
double tFloat64
type definition for Float64 (64bit double values) (platform and compiler independent type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
Simple statistics.
Definition: statistics.h:19
tBool IsUpdated()
Whether or not events have already occured.
tTimeStamp m_nElapsed
Elapsed microseconds.
Definition: statistics.h:24
tTimeStamp m_nLogDelay
The update rate at which statistics should be printed.
Definition: statistics.h:31
cStatistics()
Default constructor.
tInt m_nUpdates
Number of updates.
Definition: statistics.h:28
tBool m_bUpdated
"Dirty" flag
Definition: statistics.h:36
cString m_strIdentifier
Statistics identifier.
Definition: statistics.h:30
tInt m_nCounter
Internal counter.
Definition: statistics.h:26
tFloat64 m_fUpdateRate
Updates per second.
Definition: statistics.h:27
tVoid Update(tInt nCount=1)
Adds new events to the object.
tFloat64 GetFloatValue()
Returns the update rate.
cStatistics(const tChar *strIdentifier, tInt nLogDelay=5000, const tChar *strIntMask=nullptr, const tChar *strFloatMask=nullptr)
Creates a new statistics object.
cString m_strFloatMask
Printf-style format specification for floating-point values.
Definition: statistics.h:34
tVoid Init(const tChar *strIdentifier, tInt nLogDelay=5000, const tChar *strIntMask=nullptr, const tChar *strFloatMask=nullptr)
(Re)initializes a statistics object.
tTimeStamp m_nLastLogTime
The last time the statistics were logged.
Definition: statistics.h:25
tVoid Reset()
Resets all statistics.
cString m_strIntMask
Printf-style format specification for integer values.
Definition: statistics.h:33
tTimeStamp m_nLastUpdateTime
The last time the statistics were updated.
Definition: statistics.h:23
tInt GetIntValue()
Returns the number of recorded events.
#define A_UTILS_D(__pclassname_)
Helper macro for d-pattern definitions.
Definition: d_ptr.h:270
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
Definition: d_ptr.h:11