This class implements a frequency counter.
More...
#include <CFrequencyCounter.h>
cFrequencyCounter is a basic frequency counter. Frequency is defined as the number of events of a particular sort occurring in a set period of time. The sampling time period is adjustable but is set at 1 second as a default value.
By calling the method signal() a counter is incremented. When the internal clock reaches the programmed timeout period (1 second for instance), the frequency value is computed and updated.
chai3d::cFrequencyCounter::cFrequencyCounter |
( |
const double |
a_timePeriod = 1.0 | ) |
|
virtual chai3d::cFrequencyCounter::~cFrequencyCounter |
( |
| ) |
|
|
inlinevirtual |
void chai3d::cFrequencyCounter::reset |
( |
| ) |
|
This method resets the frequency counter to zero.
void chai3d::cFrequencyCounter::setTimePeriod |
( |
const double & |
a_timePeriod | ) |
|
This method sets the time period of the frequency counter.
- Parameters
-
a_timePeriod | Time period in seconds. |
double chai3d::cFrequencyCounter::getTimePeriod |
( |
| ) |
const |
|
inline |
double chai3d::cFrequencyCounter::getFrequency |
( |
| ) |
|
|
inline |
double chai3d::cFrequencyCounter::signal |
( |
const unsigned int |
a_numEvents = 1 | ) |
|
This method signals one of more events (The default value is 1). The reported events are added to the event counter and the frequency is estimated from the time reported by the high precision clock.
- Parameters
-
a_numEvents | Number of new events. |
- Returns
- Most recent estimated frequency value in Hertz.
double chai3d::cFrequencyCounter::m_frequency |
|
protected |
unsigned int chai3d::cFrequencyCounter::m_counter |
|
protected |
The documentation for this class was generated from the following files: