From 8e75185060aed29082b802f4ba52e44851369a73 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 11 Jun 2016 17:21:04 -0400 Subject: [PATCH] made avgReadCount and avgSendCound to be uint32_t instead of floats, since they count bytes. Changes kb to 1024 instead of 1000 --- libretroshare/src/pqi/pqistreamer.cc | 4 ++-- libretroshare/src/pqi/pqistreamer.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libretroshare/src/pqi/pqistreamer.cc b/libretroshare/src/pqi/pqistreamer.cc index af890f77f..6665a90c3 100644 --- a/libretroshare/src/pqi/pqistreamer.cc +++ b/libretroshare/src/pqi/pqistreamer.cc @@ -227,8 +227,8 @@ void pqistreamer::updateRates() if (diff > PQISTREAM_AVG_PERIOD) { - float avgReadpSec = getRate(true ) * PQISTREAM_AVG_FRAC + (1.0 - PQISTREAM_AVG_FRAC) * mAvgReadCount/(1000.0 * float(diff)); - float avgSentpSec = getRate(false) * PQISTREAM_AVG_FRAC + (1.0 - PQISTREAM_AVG_FRAC) * mAvgSentCount/(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/(1024.0 * float(diff)); #ifdef DEBUG_PQISTREAMER std::cerr << "Peer " << PeerId() << ": Current speed estimates: " << avgReadpSec << " / " << avgSentpSec << std::endl; diff --git a/libretroshare/src/pqi/pqistreamer.h b/libretroshare/src/pqi/pqistreamer.h index 80344d6cd..542888e17 100644 --- a/libretroshare/src/pqi/pqistreamer.h +++ b/libretroshare/src/pqi/pqistreamer.h @@ -154,8 +154,8 @@ class pqistreamer: public PQInterface time_t mCurrSentTS; time_t mAvgLastUpdate; // TS from which these are measured. - float mAvgReadCount; - float mAvgSentCount; + uint32_t mAvgReadCount; + uint32_t mAvgSentCount; time_t mLastIncomingTs;