3#include <QtCore/QElapsedTimer>
4#include <QtCore/QtGlobal>
29 double kBps()
const {
return _currentRate / 1024.0; }
40 quint64 _totalBytes = 0;
41 qsizetype _windowBytes = 0;
42 double _currentRate = 0.0;
43 bool _rateUpdated =
false;
45 static constexpr qint64 kWindowMs = 1000;
void reset()
Reset all counters and restart the elapsed timer.
double kBps() const
Current data rate in KB/s.
void recordBytes(qsizetype bytes)
Record incoming/outgoing bytes. Call whenever data passes through.
double bytesPerSec() const
quint64 totalBytes() const
Total bytes recorded since construction or last reset.