CFEL - ASG Software Suite
2.5.0
CASS
|
class calculating a rate in Hz. More...
#include <ratemeter.h>
Public Member Functions | |
Ratemeter (const double averagetime=1) | |
constuctor More... | |
double | calculateRate () |
retrieve the rate More... | |
void | count (double increase=1.) |
increase the counts More... | |
Private Attributes | |
QMutex | _mutex |
mutex to make function counting reentrant More... | |
QTime | _time |
the time to stop the timeinterval More... | |
double | _counts |
a counter that will increase with each call to count More... | |
double | _rate |
the current rate More... | |
const double | _averagetime |
time constant with which the rate will decrease More... | |
class calculating a rate in Hz.
slot count has to be called to increase the count the current rate will be updated once the rate is retrieved
Definition at line 28 of file ratemeter.h.
Ratemeter::Ratemeter | ( | const double | averagetime = 1 | ) |
constuctor
averagetime | time in seconds over which you want to average the rate. Default is 1 s. |
Definition at line 17 of file ratemeter.cpp.
References _time, and QTime::start().
double Ratemeter::calculateRate | ( | ) |
retrieve the rate
the rate is calculated using the formular found in wiki at
Definition at line 26 of file ratemeter.cpp.
References _averagetime, _counts, _rate, _time, QTime::elapsed(), and QTime::restart().
Referenced by cass::RatePlotter::run().
void Ratemeter::count | ( | double | increase = 1. | ) |
increase the counts
this function is locked by a mutex to make it reentrant
increase | the value to increase by. Default is 1. |
Definition at line 42 of file ratemeter.cpp.
References _counts, and _mutex.
Referenced by cass::Worker::runthis().
|
private |
time constant with which the rate will decrease
Definition at line 70 of file ratemeter.h.
Referenced by calculateRate().
|
private |
a counter that will increase with each call to count
Definition at line 64 of file ratemeter.h.
Referenced by calculateRate(), and count().
|
private |
mutex to make function counting reentrant
Definition at line 58 of file ratemeter.h.
Referenced by count().
|
private |
|
private |
the time to stop the timeinterval
Definition at line 61 of file ratemeter.h.
Referenced by calculateRate(), and Ratemeter().