diff options
Diffstat (limited to 'src/Xmobar/Plugins/Monitors')
-rw-r--r-- | src/Xmobar/Plugins/Monitors/Cpu/FreeBSD.hs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Cpu/FreeBSD.hs b/src/Xmobar/Plugins/Monitors/Cpu/FreeBSD.hs index 7cb711a..7c80e55 100644 --- a/src/Xmobar/Plugins/Monitors/Cpu/FreeBSD.hs +++ b/src/Xmobar/Plugins/Monitors/Cpu/FreeBSD.hs @@ -39,11 +39,16 @@ parseCpu cref = do intr = diff !! 3 idle = diff !! 4 total = user + nice + system + intr + idle + cpuUserPerc = if total > 0 then user/total else 0 + cpuNicePerc = if total > 0 then nice/total else 0 + cpuSystemPerc = if total > 0 then (system+intr)/total else 0 + cpuIdlePerc = if total > 0 then idle/total else 0 + return CpuData - { cpuUser = user/total - , cpuNice = nice/total - , cpuSystem = (system+intr)/total - , cpuIdle = idle/total + { cpuUser = cpuUserPerc + , cpuNice = cpuNicePerc + , cpuSystem = cpuSystemPerc + , cpuIdle = cpuIdlePerc , cpuIowait = 0 - , cpuTotal = user/total + , cpuTotal = cpuUserPerc+cpuSystemPerc } |