From a9f7a2048047fa2e0b69b052d4d91d122f870e3d Mon Sep 17 00:00:00 2001 From: "Paul Buetow (europa)" Date: Mon, 25 May 2015 23:04:14 +0100 Subject: can calc diffs --- gstat/main.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gstat/main.go b/gstat/main.go index 61f3c68..312e066 100644 --- a/gstat/main.go +++ b/gstat/main.go @@ -40,8 +40,14 @@ func receiveD(dRxChan <-chan diskstats.Diskstats) { } func compareP(lastP processMap) { - for _, val := range lastP { - fmt.Printf("%d <-> %d\n", val.first.Pid, val.second.Pid) + for id, val := range lastP { + first := val.first.Count["syscr"] + second := val.second.Count["syscr"] + diff := first - second + if diff < 0 { + diff = -diff + } + fmt.Printf("%d %s\n", diff, id) } } @@ -80,7 +86,7 @@ func main() { for counter := 0; counter < 5; counter++ { timerChan <- true - time.Sleep(time.Second * 1) + time.Sleep(time.Second * 2) } timerChan <- false -- cgit v1.2.3