diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2011-08-21 19:48:44 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2011-08-21 19:48:44 +0200 |
commit | 1fab853cb8a76eb9b7c5400924a8c53b3b095712 (patch) | |
tree | 54f20fb5987904700669d67519cc45169ae78bb7 /src/Plugins/Monitors/CpuFreq.hs | |
parent | 8afb450eb104e5335f4b1b976512842f7059142c (diff) | |
parent | 4a57c777bccbf169aa50411ecaed0af333ac6871 (diff) | |
download | xmobar-1fab853cb8a76eb9b7c5400924a8c53b3b095712.tar.gz xmobar-1fab853cb8a76eb9b7c5400924a8c53b3b095712.tar.bz2 |
Merge remote-tracking branch 'github/master'
Diffstat (limited to 'src/Plugins/Monitors/CpuFreq.hs')
-rw-r--r-- | src/Plugins/Monitors/CpuFreq.hs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/Plugins/Monitors/CpuFreq.hs b/src/Plugins/Monitors/CpuFreq.hs index 4f01922..dcf75e5 100644 --- a/src/Plugins/Monitors/CpuFreq.hs +++ b/src/Plugins/Monitors/CpuFreq.hs @@ -28,16 +28,12 @@ cpuFreqConfig = mkMConfig -- replacements -- | --- Function retrieves monitor string holding the cpu frequency (or --- frequencies) +-- Function retrieves monitor string holding the cpu frequency (or frequencies) runCpuFreq :: [String] -> Monitor String -runCpuFreq _ = do - let dir = "/sys/devices/system/cpu" - file = "cpufreq/scaling_cur_freq" - pattern = "cpu" - divisor = 1e6 :: Double - failureMessage = "CpuFreq: N/A" - fmt x | x < 1 = show (round (x * 1000) :: Integer) ++ "MHz" - | otherwise = showDigits 1 x ++ "GHz" - checkedDataRetrieval failureMessage dir file pattern (/divisor) fmt +runCpuFreq _ = let path = ["/sys/devices/system/cpu/cpu", "/cpufreq/scaling_cur_freq"] + divisor = 1e6 :: Double + failureMessage = "CpuFreq: N/A" + fmt x | x < 1 = (show (round (x * 1000) :: Integer)) ++ "MHz" + | otherwise = (show x) ++ "GHz" + in checkedDataRetrieval failureMessage path Nothing (/divisor) fmt |