From 92e93189528bcf583344dad81720abba935d5056 Mon Sep 17 00:00:00 2001 From: MichaƂ Zielonka Date: Tue, 19 Oct 2021 23:53:30 +0200 Subject: add cirrus freebsd test (#580) For start cirrus please use: https://cirrus-ci.org/guide/quick-start/ choose public repositories plan and add only xmobar as observed by cirrus. Also here is addes small fix for dividing by zero when cpu usage is calculated --- src/Xmobar/Plugins/Monitors/Cpu/FreeBSD.hs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/Xmobar') 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 } -- cgit v1.2.3