Output channel utilization as percentage
This commit is contained in:
parent
92aac7b7ca
commit
c30d6bc281
@ -44,8 +44,8 @@ func (cur *WirelessAirtime) SetUtilization(prev *WirelessAirtime) {
|
|||||||
|
|
||||||
// Calculate utilizations
|
// Calculate utilizations
|
||||||
if active > 0 {
|
if active > 0 {
|
||||||
cur.ChanUtil = (busy + rx + tx) / active
|
cur.ChanUtil = 100 * (busy + rx + tx) / active
|
||||||
cur.RxUtil = rx / active
|
cur.RxUtil = 100 * rx / active
|
||||||
cur.TxUtil = tx / active
|
cur.TxUtil = 100 * tx / active
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,12 +35,12 @@ func TestUtilization(t *testing.T) {
|
|||||||
|
|
||||||
t2.SetUtilization(t1)
|
t2.SetUtilization(t1)
|
||||||
assert.NotZero(t2.ChanUtil)
|
assert.NotZero(t2.ChanUtil)
|
||||||
assert.EqualValues(0.45, t2.ChanUtil)
|
assert.EqualValues(45, t2.ChanUtil)
|
||||||
assert.EqualValues(0.2, t2.RxUtil)
|
assert.EqualValues(20, t2.RxUtil)
|
||||||
assert.EqualValues(0.15, t2.TxUtil)
|
assert.EqualValues(15, t2.TxUtil)
|
||||||
|
|
||||||
t3.SetUtilization(t2)
|
t3.SetUtilization(t2)
|
||||||
assert.EqualValues(0.5, t3.ChanUtil)
|
assert.EqualValues(50, t3.ChanUtil)
|
||||||
assert.EqualValues(0.125, t3.RxUtil)
|
assert.EqualValues(12.5, t3.RxUtil)
|
||||||
assert.EqualValues(0, t3.TxUtil)
|
assert.EqualValues(0, t3.TxUtil)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user