Why you use “load” instead of “CPU usage” – and how to track iowait in conky

technology.pngI’ve been using load – as well as CPU and RAM usage – as measures of system stress on my computer for a while now.  They all display pretty nicely and easily in conky.

And then I’ll notice something like Google Music, or SpiderOak, or even copying large files via USB will spike my load something fierce.  I believe this is because of the I/O access – but I can’t be sure.  Typing iostat will give me that information, but if my system is already struggling, I don’t want to have to open a new terminal window and then parse that output for one bit of information.  If the load – or CPU, or whatever – is spiking for a known reason, I’ll let it just go for a while and resolve itself.

For example, on boot.  It was really distressing to see my load values jump well over 5 (they should only be 2 at most on my dual-core machine).  I guessed that it was due to I/O access, but I couldn’t prove it.

So I wrote a small script to just parse out the iowait value from iostat:

iostat -c -k -z | tail -2 | head -1 | awk ‘{print $4}’

I’m sure there’s a simpler way, but this works.  I get a number back, so my output looks something like this (like, right now)

CPU – RAM – iowait – CPU Temp – Uptime – load

Decent load for a dual-core machine (I have some background stuff running as well).  My CPU percentage is only 13%.  Spiffy.   But about eight minutes before, this is what it looked like:

CPU – RAM – iowait – CPU Temp – Uptime – load

This is just after startup – when everything’s still connecting, and so on.  Note that while the CPU percentage is only 4% higher, the load is almost seven times higher.  What’s different?  The iowait value.  The load is bogged down by the I/O access, not the CPU.

Want to add this to your conky?  Very easy.  Take the above and put it in a bash script, so it’s like this:

iostat -c -k -z | tail -2 | head -1 | awk ‘{print $4}’

I called it iowait.sh .  Make it executable (sudo chmod +x iowait.sh).  Then in your .conkyrc file, it’s simply adding a shell command:

${exec /home/USER/scripts/iowait.sh}

And there you go!

blankWas this post helpful or insightful? Buy me a coffee here or here and share this post with others!

Popular posts:

  • The difference between boundaries and rules
  • Two Ways to get CMYK Separation Using GIMP Instead of Photoshop in 2022
  • Weekend Project: Whole House and Streaming Audio for Free with MPD
  • Organizing and Tiling Your Windows on #Openbox Using Only... Openbox
  • Simple Smart Playlists for MPD (that work!)
  • If there's one Nazi (or a racist) at the table...

Recent Posts