summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2011-08-21 21:21:02 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2011-08-21 21:21:02 +0200
commitd17958115fbb80d5baf58830f33390cd21acedac (patch)
treecfb558267a25184fb321b0b79dedc260dead012c
parentbe97b76ef677a33aea1b688aeba8453c8db6306c (diff)
downloadxmobar-d17958115fbb80d5baf58830f33390cd21acedac.tar.gz
xmobar-d17958115fbb80d5baf58830f33390cd21acedac.tar.bz2
Report iowait in Cpu monitor (fixes #55)
-rw-r--r--NEWS2
-rw-r--r--README2
-rw-r--r--src/Plugins/Monitors/Cpu.hs4
3 files changed, 5 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 60d343a..361417f 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ _New features_
- New brightness monitor, courtesy of Martin Perner.
- New DateZone plugin, for localized datetimes, also by Martin.
+ - Cpu monitor now also reports `iowait` field ([issue 55]).
_Bug fixes_
@@ -19,6 +20,7 @@ _Bug fixes_
[issue 48]: http://code.google.com/p/xmobar/issues/detail?id=48
[issue 50]: http://code.google.com/p/xmobar/issues/detail?id=50
+[issue 55]: http://code.google.com/p/xmobar/issues/detail?id=55
## Version 0.13 (March 28, 2011)
diff --git a/README b/README
index 626130d..caaa882 100644
--- a/README
+++ b/README
@@ -407,7 +407,7 @@ Monitors have default aliases.
- Aliases to `cpu`
- Args: default monitor arguments (see below)
- Variables that can be used with the `-t`/`--template` argument:
- `total`, `bar`, `user`, `nice`, `system`, `idle`
+ `total`, `bar`, `user`, `nice`, `system`, `idle`, `iowait`
- Default template: `Cpu: <total>%`
`MultiCpu Args RefreshRate`
diff --git a/src/Plugins/Monitors/Cpu.hs b/src/Plugins/Monitors/Cpu.hs
index 919f7a4..6627f53 100644
--- a/src/Plugins/Monitors/Cpu.hs
+++ b/src/Plugins/Monitors/Cpu.hs
@@ -22,7 +22,7 @@ import Data.IORef (IORef, newIORef, readIORef, writeIORef)
cpuConfig :: IO MConfig
cpuConfig = mkMConfig
"Cpu: <total>%"
- ["bar","total","user","nice","system","idle"]
+ ["bar","total","user","nice","system","idle","iowait"]
type CpuDataRef = IORef [Float]
@@ -45,7 +45,7 @@ parseCpu cref =
formatCpu :: [Float] -> Monitor [String]
formatCpu [] = return $ replicate 6 ""
formatCpu xs = do
- let t = foldr (+) 0 $ take 3 xs
+ let t = sum $ take 3 xs
b <- showPercentBar (100 * t) t
ps <- showPercentsWithColors (t:xs)
return (b:ps)