diff --git a/data/airtime.go b/data/airtime.go index caecb46..b027ac1 100644 --- a/data/airtime.go +++ b/data/airtime.go @@ -44,8 +44,8 @@ func (cur *WirelessAirtime) SetUtilization(prev *WirelessAirtime) { // Calculate utilizations if active > 0 { - cur.ChanUtil = (busy + rx + tx) / active - cur.RxUtil = rx / active - cur.TxUtil = tx / active + cur.ChanUtil = 100 * (busy + rx + tx) / active + cur.RxUtil = 100 * rx / active + cur.TxUtil = 100 * tx / active } } diff --git a/data/airtime_test.go b/data/airtime_test.go index c438848..66a041f 100644 --- a/data/airtime_test.go +++ b/data/airtime_test.go @@ -35,12 +35,12 @@ func TestUtilization(t *testing.T) { t2.SetUtilization(t1) assert.NotZero(t2.ChanUtil) - assert.EqualValues(0.45, t2.ChanUtil) - assert.EqualValues(0.2, t2.RxUtil) - assert.EqualValues(0.15, t2.TxUtil) + assert.EqualValues(45, t2.ChanUtil) + assert.EqualValues(20, t2.RxUtil) + assert.EqualValues(15, t2.TxUtil) t3.SetUtilization(t2) - assert.EqualValues(0.5, t3.ChanUtil) - assert.EqualValues(0.125, t3.RxUtil) + assert.EqualValues(50, t3.ChanUtil) + assert.EqualValues(12.5, t3.RxUtil) assert.EqualValues(0, t3.TxUtil) }