|
QGroundControl
Ground Control Station for MAVLink Drones
|
#include <DataRateTracker.h>
Public Member Functions | |
| DataRateTracker () | |
| void | recordBytes (qsizetype bytes) |
| Record incoming/outgoing bytes. Call whenever data passes through. | |
| quint64 | totalBytes () const |
| Total bytes recorded since construction or last reset. | |
| double | bytesPerSec () const |
| double | kBps () const |
| Current data rate in KB/s. | |
| bool | rateUpdated () const |
| void | reset () |
| Reset all counters and restart the elapsed timer. | |
Lightweight, non-QObject helper that tracks a rolling data rate.
Call recordBytes() whenever data passes through. The rate window is kWindowMs milliseconds; once elapsed time crosses that threshold, _currentRate is recalculated and rateUpdated() returns true for that call.
Thread safety: none — use from a single thread.
Definition at line 13 of file DataRateTracker.h.
| DataRateTracker::DataRateTracker | ( | ) |
Definition at line 3 of file DataRateTracker.cc.
|
inline |
Current data rate in bytes/sec. Recalculated on each recordBytes() call. Returns 0 if no data has been recorded since the last window expired.
Definition at line 26 of file DataRateTracker.h.
Referenced by NTRIPConnectionStats::dataRateBytesPerSec(), NTRIPConnectionStats::NTRIPConnectionStats(), and NTRIPConnectionStats::stop().
|
inline |
Current data rate in KB/s.
Definition at line 29 of file DataRateTracker.h.
Referenced by RTCMMavlink::bandwidthKBps(), and RTCMMavlink::RTCMDataUpdate().
|
inline |
Whether the rate was recalculated on the last recordBytes() call. Useful for the caller to know when to emit signals.
Definition at line 33 of file DataRateTracker.h.
Referenced by NTRIPConnectionStats::recordMessage(), and RTCMMavlink::RTCMDataUpdate().
| void DataRateTracker::recordBytes | ( | qsizetype | bytes | ) |
Record incoming/outgoing bytes. Call whenever data passes through.
Definition at line 8 of file DataRateTracker.cc.
Referenced by NTRIPConnectionStats::recordMessage(), and RTCMMavlink::RTCMDataUpdate().
| void DataRateTracker::reset | ( | ) |
Reset all counters and restart the elapsed timer.
Definition at line 24 of file DataRateTracker.cc.
Referenced by NTRIPConnectionStats::reset(), and NTRIPConnectionStats::stop().
|
inline |
Total bytes recorded since construction or last reset.
Definition at line 22 of file DataRateTracker.h.
Referenced by NTRIPConnectionStats::bytesReceived(), NTRIPConnectionStats::NTRIPConnectionStats(), NTRIPConnectionStats::recordMessage(), and RTCMMavlink::totalBytesSent().