summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Plugins/Monitors/Top.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Plugins/Monitors/Top.hs b/Plugins/Monitors/Top.hs
index 30476ac..7246183 100644
--- a/Plugins/Monitors/Top.hs
+++ b/Plugins/Monitors/Top.hs
@@ -133,8 +133,10 @@ topProcesses tref scale = do
c1 <- getCurrentTime
atomicModifyIORef tref $ \(t0, c0) ->
let scx = realToFrac (diffUTCTime c1 c0) * scale / 100
+ -- c0 and c1 can be equal, for instance, if we come back from sleep
+ !scx' = if scx > 0 then scx else (scale / 100)
ts = M.elems $ combineTimeInfos t0 t1
- nts = map (\(nm, t) -> (nm, min 100 (t / scx))) ts
+ nts = map (\(nm, t) -> (nm, min 100 (t / scx'))) ts
in ((t1, c1), (len, sortTop nts, sortTop mis))
showTimeInfo :: TimeInfo -> Monitor [String]