diff options
| author | Paul Buetow (europa) <paul@buetow.org> | 2015-05-25 21:57:13 +0100 |
|---|---|---|
| committer | Paul Buetow (europa) <paul@buetow.org> | 2015-05-25 21:57:13 +0100 |
| commit | b41d48ef0817025251ce080578168fd85cab15f9 (patch) | |
| tree | 6c9f11e599d4c1f02274efe16f6bdc378ad20ae5 /gstat | |
| parent | 10074fefc76404a1be7bddcc2b9d18bc0ee44056 (diff) | |
store prev results into a process map
Diffstat (limited to 'gstat')
| -rw-r--r-- | gstat/main.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gstat/main.go b/gstat/main.go index 254edeb..9aefa60 100644 --- a/gstat/main.go +++ b/gstat/main.go @@ -7,6 +7,10 @@ import ( "time" ) +type processMap map[string]process.Process + +var lastP processMap + func gather(timer <-chan bool, d chan<- diskstats.Diskstats, p chan<- process.Process) { for { switch <-timer { @@ -32,7 +36,9 @@ func receive1(diskstats <-chan diskstats.Diskstats) { } func receive2(processes <-chan process.Process) { + lastP = make(processMap) for process := range processes { + lastP[process.Id] = process process.Print() } } @@ -48,7 +54,7 @@ func main() { for counter := 0; counter < 3; counter++ { timer <- true - time.Sleep(time.Second) + time.Sleep(time.Second * 2) fmt.Printf("Next... %d\n", counter) } |
