From 89ed90ed396988e4c37533877e1c7b936fbd4678 Mon Sep 17 00:00:00 2001 From: Juraj Hercek Date: Sat, 16 Feb 2008 17:06:50 +0100 Subject: Adjusted filter used for digging out information from /sys directory - As of 2.4.24 kernel you might experience same frequency for all cores, because cpufreq directory is a link for cores 1 and higher darcs-hash:20080216160650-f49a6-455bdfa46154350d723759d7175629892b284e0e.gz --- Plugins/Monitors/CoreCommon.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Plugins/Monitors/CoreCommon.hs') diff --git a/Plugins/Monitors/CoreCommon.hs b/Plugins/Monitors/CoreCommon.hs index 9a19cd5..d40b30a 100644 --- a/Plugins/Monitors/CoreCommon.hs +++ b/Plugins/Monitors/CoreCommon.hs @@ -17,6 +17,8 @@ module Plugins.Monitors.CoreCommon where import Plugins.Monitors.Common import System.Posix.Files (fileExist) import System.Directory +import Data.Char (isDigit) +import Data.List (isPrefixOf) -- | -- Function checks the existence of first file specified by pattern and if the @@ -42,7 +44,8 @@ retrieveData dir file pattern divisor = do where dirCount path str = getDirectoryContents path >>= return . length - . filter ((str ==) . take (length str)) + . filter (\s -> str `isPrefixOf` s + && isDigit (last s)) files count = [ foldl (++) dir [ "/", pattern, show i, "/", file ] | i <- [0 .. count - 1] ] conversion = flip (/) divisor . (read :: String -> Double) -- cgit v1.2.3