diff options
Diffstat (limited to 'src/Plugins/Monitors/Mem.hs')
-rw-r--r-- | src/Plugins/Monitors/Mem.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Plugins/Monitors/Mem.hs b/src/Plugins/Monitors/Mem.hs index e409095..db2e5de 100644 --- a/src/Plugins/Monitors/Mem.hs +++ b/src/Plugins/Monitors/Mem.hs @@ -30,10 +30,10 @@ parseMEM :: IO [Float] parseMEM = do file <- fileMEM let content = map words $ take 8 $ lines file - info = M.fromList $ map (\line -> (line !! 0, (read $ line !! 1 :: Float) / 1024)) content + info = M.fromList $ map (\line -> (head line, (read $ line !! 1 :: Float) / 1024)) content [total, free, buffer, cache] = map (info M.!) ["MemTotal:", "MemFree:", "Buffers:", "Cached:"] rest = free + buffer + cache - used = total - (M.findWithDefault rest "MemAvailable:" info) + used = total - M.findWithDefault rest "MemAvailable:" info usedratio = used / total freeratio = free / total return [usedratio, freeratio, total, free, buffer, cache, rest, used, freeratio] |