diff options
| author | Paul Buetow (europa) <paul@buetow.org> | 2015-06-01 22:47:44 +0100 |
|---|---|---|
| committer | Paul Buetow (europa) <paul@buetow.org> | 2015-06-01 22:47:44 +0100 |
| commit | 23bb93a0962be33b0d10e5e589e667736a77666d (patch) | |
| tree | 89b31b189fb9e55facfd8749e751d926d5d496b3 | |
| parent | 699178f79506482cb319c84a033d7a45d50a76f9 (diff) | |
Use average values
| -rw-r--r-- | gotop/main.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gotop/main.go b/gotop/main.go index 9c7b2d8..cf347d4 100644 --- a/gotop/main.go +++ b/gotop/main.go @@ -169,12 +169,18 @@ func receiveP(pRxChan <-chan process.Process) { log.Fatal(err) } config.modeName = modeName + seconds := config.interval.Seconds() makeDiff := func(first, second process.Process) twoP { firstValR, firstValW := first.Count[readKey], first.Count[writeKey] secondValR, secondValW := second.Count[readKey], second.Count[writeKey] diffR, diffW := utils.Abs(firstValR-secondValR), utils.Abs(firstValW-secondValW) - diff := diffR + diffW + + // Calculate averages + diff := int(float64(diffR+diffW) / seconds) + diffR = int(float64(diffR) / seconds) + diffW = int(float64(diffW) / seconds) + return twoP{first, second, diff, diffR, diffW, false} } |
