From 37e28c93a04dbbba69c85f1b461653d9fbb01591 Mon Sep 17 00:00:00 2001 From: "Paul Buetow (europa)" Date: Mon, 1 Jun 2015 22:55:03 +0100 Subject: fix --- gotop/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gotop/main.go b/gotop/main.go index cf347d4..0af15f3 100644 --- a/gotop/main.go +++ b/gotop/main.go @@ -65,7 +65,8 @@ func sortP(lastP *mapP) *list.List { for _, val := range *lastP { nowTimestamp := int32(time.Now().Unix()) - if val.first.Timestamp+4 < nowTimestamp { + seconds := int32(config.interval.Seconds()) + if val.first.Timestamp+seconds < nowTimestamp { // Schedule remove obsolete pids from lastP remove.PushBack(val.first.Id) // Display this process one more time, but in a fancy way @@ -176,7 +177,7 @@ func receiveP(pRxChan <-chan process.Process) { secondValR, secondValW := second.Count[readKey], second.Count[writeKey] diffR, diffW := utils.Abs(firstValR-secondValR), utils.Abs(firstValW-secondValW) - // Calculate averages + // Calculate averages, so we have always per second valus diff := int(float64(diffR+diffW) / seconds) diffR = int(float64(diffR) / seconds) diffW = int(float64(diffW) / seconds) -- cgit v1.2.3