summaryrefslogtreecommitdiffhomepage
path: root/Plugins
diff options
context:
space:
mode:
authorJose A Ortega Ruiz <jao@gnu.org>2010-03-29 03:05:52 +0200
committerJose A Ortega Ruiz <jao@gnu.org>2010-03-29 03:05:52 +0200
commit31109fc21a7a93875471f251c8aea201b3df4926 (patch)
tree611bb3fd153ef4fadf911ad8e83e80f512076af1 /Plugins
parent42eb89dd90f50c1c7847a43cde50886ce50f2e30 (diff)
downloadxmobar-31109fc21a7a93875471f251c8aea201b3df4926.tar.gz
xmobar-31109fc21a7a93875471f251c8aea201b3df4926.tar.bz2
Tiny refactoring.
Ignore-this: 5572afe54ca8aa3d13ebb34e431baa91 darcs-hash:20100329010552-748be-58fbdbfd053bb21ba1c4ebec82fa2bc5e85d0cff.gz
Diffstat (limited to 'Plugins')
-rw-r--r--Plugins/Monitors/Top.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Plugins/Monitors/Top.hs b/Plugins/Monitors/Top.hs
index 911a079..93fd940 100644
--- a/Plugins/Monitors/Top.hs
+++ b/Plugins/Monitors/Top.hs
@@ -127,22 +127,22 @@ combineTimeInfos :: Times -> Times -> Times
combineTimeInfos t0 t1 = M.intersectionWith timeDiff t1 t0
where timeDiff (n, x1) (_, x0) = (n, x1 - x0)
-topProcesses :: TimesRef -> Float -> IO (Int, ([TimeInfo], [Meminfo]))
+topProcesses :: TimesRef -> Float -> IO (Int, [TimeInfo], [Meminfo])
topProcesses tref scale = do
- c1 <- getCurrentTime
(t1, mis, len) <- timeMemInfos
+ c1 <- getCurrentTime
atomicModifyIORef tref $ \(t0, c0) ->
let scx = (fromRational . toRational $ diffUTCTime c1 c0) * scale / 100
ts = M.elems $ combineTimeInfos t0 t1
nts = map (\(nm, t) -> (nm, t / scx)) ts
- in ((t1, c1), (len, (sortTop nts, sortTop mis)))
+ in ((t1, c1), (len, sortTop nts, sortTop mis))
showTimeInfo :: TimeInfo -> Monitor [String]
showTimeInfo (n, t) = showInfo n (showDigits 1 t) t
runTop :: TimesRef -> Float -> Float -> [String] -> Monitor String
runTop tref scale mscale _ = do
- (no, (ps, ms)) <- io $ topProcesses tref scale
+ (no, ps, ms) <- io $ topProcesses tref scale
pstr <- mapM showTimeInfo ps
mstr <- mapM (showMeminfo mscale) ms
parseTemplate $! show no : concat (zipWith (++) pstr mstr)