From 52264d5e284c49817fa0a4dd4f1f0c9feeced41d Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Thu, 14 Jun 2018 16:48:35 -0700 Subject: [PATCH] Fixed aggregateLinkLatency(). Also changed unit for throughput from byte to bit --- node/Path.hpp | 2 +- node/Peer.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/node/Path.hpp b/node/Path.hpp index 6162be20b..fb2023069 100644 --- a/node/Path.hpp +++ b/node/Path.hpp @@ -365,7 +365,7 @@ public: _unackedBytes = (ackedBytes > _unackedBytes) ? 0 : _unackedBytes - ackedBytes; int64_t timeSinceThroughputEstimate = (now - _lastThroughputEstimation); if (timeSinceThroughputEstimate >= ZT_PATH_THROUGHPUT_MEASUREMENT_INTERVAL) { - uint64_t throughput = (float)(_bytesAckedSinceLastThroughputEstimation) / ((float)timeSinceThroughputEstimate / (float)1000); + uint64_t throughput = (float)(_bytesAckedSinceLastThroughputEstimation * 8) / ((float)timeSinceThroughputEstimate / (float)1000); _throughputSamples->push(throughput); _maxLifetimeThroughput = throughput > _maxLifetimeThroughput ? throughput : _maxLifetimeThroughput; _lastThroughputEstimation = now; diff --git a/node/Peer.cpp b/node/Peer.cpp index 0f471b072..1d581ab8e 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -349,12 +349,14 @@ float Peer::computeAggregateLinkPacketDelayVariance() float Peer::computeAggregateLinkMeanLatency() { float ml = 0.0; + int pathCount = 0; for(unsigned int i=0;irelativeQuality() * _paths[i].p->meanLatency(); } } - return ml; + return ml / pathCount; } int Peer::aggregateLinkPhysicalPathCount()