From 6db48566e47efcbe8e26f3077712cc08b41701d4 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosciuszkiewicz Date: Tue, 10 Jul 2007 16:15:50 +0200 Subject: Formatting usedratio in Monitors.Swap darcs-hash:20070710141550-ba08c-383d0d84c0d8b31fae5b35e6b16070ba4d2e41f3.gz --- Monitors/Swap.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Monitors') diff --git a/Monitors/Swap.hs b/Monitors/Swap.hs index 9fb6cc0..6cfdbdd 100644 --- a/Monitors/Swap.hs +++ b/Monitors/Swap.hs @@ -35,12 +35,16 @@ parseMEM = let p x y = flip (/) 1024 . read . stringParser x $ y tot = p (1,11) file free = p (1,12) file - return [tot, (tot - free), free, (tot - free) / tot * 100] + return [tot, (tot - free), free, (tot - free) / tot] formatSwap :: [Float] -> Monitor [String] formatSwap x = - do let f n = show (takeDigits 2 n) - mapM (showWithColors f) x + do let f1 n = show (takeDigits 2 n) + f2 n = floatToPercent n + (hd, tl) = splitAt 3 x + firsts <- mapM (showWithColors f1) hd + lasts <- mapM (showWithColors f2) tl + return $ firsts ++ lasts package :: String package = "xmb-swap" -- cgit v1.2.3