From 59c17dbdb1ca05f690fc47dca77ac452b0efd721 Mon Sep 17 00:00:00 2001 From: Norbert Zeh Date: Fri, 4 Jun 2010 16:41:53 +0200 Subject: Fix strange formatting of CPU frequencies Ignore-this: 8c7108dbb071318135c54f0ff830c065 This patch displays frequencies under 1GHz as MHz and above 1GHz as GHz. Unfortunately, it was also necessary to touch CoreCommon.hs and CoreTemp.hs to implement this. darcs-hash:20100604144153-18a2b-cea493ec887c16a50bcef0db001ebbce3ccef74f.gz --- Plugins/Monitors/CpuFreq.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Plugins/Monitors/CpuFreq.hs') diff --git a/Plugins/Monitors/CpuFreq.hs b/Plugins/Monitors/CpuFreq.hs index 70482f5..fd1da4c 100644 --- a/Plugins/Monitors/CpuFreq.hs +++ b/Plugins/Monitors/CpuFreq.hs @@ -23,7 +23,7 @@ import Plugins.Monitors.CoreCommon -- cpu frequencies. cpuFreqConfig :: IO MConfig cpuFreqConfig = mkMConfig - "Freq: GHz" -- template + "Freq: " -- template (zipWith (++) (repeat "cpu") (map show [0 :: Int ..])) -- available -- replacements @@ -36,5 +36,7 @@ runCpuFreq _ = do pattern = "cpu" divisor = 1e6 :: Double failureMessage = "CpuFreq: N/A" - checkedDataRetrieval failureMessage dir file pattern (/divisor) + fmt x | x < 1 = (show (round (x * 1000) :: Integer)) ++ "MHz" + | otherwise = (show x) ++ "GHz" + checkedDataRetrieval failureMessage dir file pattern (/divisor) fmt -- cgit v1.2.3