made avgReadCount and avgSendCound to be uint32_t instead of floats, since they count bytes. Changes kb to 1024 instead of 1000

This commit is contained in:
csoler 2016-06-11 17:21:04 -04:00
parent eb9025d9a4
commit 8e75185060
2 changed files with 4 additions and 4 deletions

View File

@ -227,8 +227,8 @@ void pqistreamer::updateRates()
if (diff > PQISTREAM_AVG_PERIOD) if (diff > PQISTREAM_AVG_PERIOD)
{ {
float avgReadpSec = getRate(true ) * PQISTREAM_AVG_FRAC + (1.0 - PQISTREAM_AVG_FRAC) * mAvgReadCount/(1000.0 * float(diff)); float avgReadpSec = getRate(true ) * PQISTREAM_AVG_FRAC + (1.0 - PQISTREAM_AVG_FRAC) * mAvgReadCount/(1024.0 * float(diff));
float avgSentpSec = getRate(false) * PQISTREAM_AVG_FRAC + (1.0 - PQISTREAM_AVG_FRAC) * mAvgSentCount/(1000.0 * float(diff)); float avgSentpSec = getRate(false) * PQISTREAM_AVG_FRAC + (1.0 - PQISTREAM_AVG_FRAC) * mAvgSentCount/(1024.0 * float(diff));
#ifdef DEBUG_PQISTREAMER #ifdef DEBUG_PQISTREAMER
std::cerr << "Peer " << PeerId() << ": Current speed estimates: " << avgReadpSec << " / " << avgSentpSec << std::endl; std::cerr << "Peer " << PeerId() << ": Current speed estimates: " << avgReadpSec << " / " << avgSentpSec << std::endl;

View File

@ -154,8 +154,8 @@ class pqistreamer: public PQInterface
time_t mCurrSentTS; time_t mCurrSentTS;
time_t mAvgLastUpdate; // TS from which these are measured. time_t mAvgLastUpdate; // TS from which these are measured.
float mAvgReadCount; uint32_t mAvgReadCount;
float mAvgSentCount; uint32_t mAvgSentCount;
time_t mLastIncomingTs; time_t mLastIncomingTs;