diff options
| author | Paul Buetow (europa) <paul@buetow.org> | 2015-05-25 23:04:14 +0100 |
|---|---|---|
| committer | Paul Buetow (europa) <paul@buetow.org> | 2015-05-25 23:04:14 +0100 |
| commit | a9f7a2048047fa2e0b69b052d4d91d122f870e3d (patch) | |
| tree | b2e2a0901df640cf83ff360d610ac6a45d519ca7 | |
| parent | 96820584df88162cec749a0291c395bfc7803cd2 (diff) | |
can calc diffs
| -rw-r--r-- | gstat/main.go | 12 |
1 files 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 |
