summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow (europa) <paul@buetow.org>2015-06-01 22:55:03 +0100
committerPaul Buetow (europa) <paul@buetow.org>2015-06-01 22:55:03 +0100
commit37e28c93a04dbbba69c85f1b461653d9fbb01591 (patch)
tree30bdef34c14f1a9fe07b4b080000f6bc2ece0463
parent23bb93a0962be33b0d10e5e589e667736a77666d (diff)
fix
-rw-r--r--gotop/main.go5
1 files 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)