mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Fixed aggregateLinkLatency(). Also changed unit for throughput from byte to bit
This commit is contained in:
parent
17fbb020e7
commit
52264d5e28
2 changed files with 4 additions and 2 deletions
|
@ -365,7 +365,7 @@ public:
|
||||||
_unackedBytes = (ackedBytes > _unackedBytes) ? 0 : _unackedBytes - ackedBytes;
|
_unackedBytes = (ackedBytes > _unackedBytes) ? 0 : _unackedBytes - ackedBytes;
|
||||||
int64_t timeSinceThroughputEstimate = (now - _lastThroughputEstimation);
|
int64_t timeSinceThroughputEstimate = (now - _lastThroughputEstimation);
|
||||||
if (timeSinceThroughputEstimate >= ZT_PATH_THROUGHPUT_MEASUREMENT_INTERVAL) {
|
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);
|
_throughputSamples->push(throughput);
|
||||||
_maxLifetimeThroughput = throughput > _maxLifetimeThroughput ? throughput : _maxLifetimeThroughput;
|
_maxLifetimeThroughput = throughput > _maxLifetimeThroughput ? throughput : _maxLifetimeThroughput;
|
||||||
_lastThroughputEstimation = now;
|
_lastThroughputEstimation = now;
|
||||||
|
|
|
@ -349,12 +349,14 @@ float Peer::computeAggregateLinkPacketDelayVariance()
|
||||||
float Peer::computeAggregateLinkMeanLatency()
|
float Peer::computeAggregateLinkMeanLatency()
|
||||||
{
|
{
|
||||||
float ml = 0.0;
|
float ml = 0.0;
|
||||||
|
int pathCount = 0;
|
||||||
for(unsigned int i=0;i<ZT_MAX_PEER_NETWORK_PATHS;++i) {
|
for(unsigned int i=0;i<ZT_MAX_PEER_NETWORK_PATHS;++i) {
|
||||||
if (_paths[i].p) {
|
if (_paths[i].p) {
|
||||||
|
pathCount++;
|
||||||
ml += _paths[i].p->relativeQuality() * _paths[i].p->meanLatency();
|
ml += _paths[i].p->relativeQuality() * _paths[i].p->meanLatency();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ml;
|
return ml / pathCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Peer::aggregateLinkPhysicalPathCount()
|
int Peer::aggregateLinkPhysicalPathCount()
|
||||||
|
|
Loading…
Add table
Reference in a new issue