Reduced how often relative path qualities and aggregate link allocations are computed

This commit is contained in:
Joseph Henry 2018-06-12 16:30:46 -07:00
parent 6fddf31db3
commit 0faa655b83
4 changed files with 38 additions and 24 deletions

View file

@ -119,7 +119,8 @@ public:
_packetErrorRatio(0.0),
_packetLossRatio(0),
_lastComputedStability(0.0),
_lastComputedRelativeQuality(0)
_lastComputedRelativeQuality(0),
_lastAllocation(0.0)
{
prepareBuffers();
}
@ -149,7 +150,8 @@ public:
_packetErrorRatio(0.0),
_packetLossRatio(0),
_lastComputedStability(0.0),
_lastComputedRelativeQuality(0)
_lastComputedRelativeQuality(0),
_lastAllocation(0.0)
{
prepareBuffers();
_phy->getIfName((PhySocket *)((uintptr_t)_localSocket), _ifname, 16);
@ -518,6 +520,18 @@ public:
*/
inline float relativeQuality() { return _lastComputedRelativeQuality; }
/**
* Assign a new allocation value for this path in the aggregate link
*
* @param allocation Percentage of traffic to be sent over this path to a peer
*/
inline void updateComponentAllocationOfAggregateLink(float allocation) { _lastAllocation = allocation; }
/**
* @return Percentage of traffic allocated to this path in the aggregate link
*/
inline float allocation() { return _lastAllocation; }
/**
* @return Stability estimates can become expensive to compute, we cache the most recent result.
*/
@ -682,6 +696,7 @@ private:
// cached estimates
float _lastComputedStability;
float _lastComputedRelativeQuality;
float _lastAllocation;
// cached human-readable strings for tracing purposes
char _ifname[16];