I'm currently designing a graph system for a website that shows current CPU usage, you can see my work in progress here - http://nereus.rikkuness.net/admin/cpu2.php
It's working exactly as I want it to at the moment, but the problem is the way that I am polling for CPU usage is currently
sar 1 | sed -n '5p' | awk '{ print $8; }'
Which works fine but it takes around a second or so to reply with CPU usage which is making the graph not update as I would expect it to in the browser.
Any help on a command that will give me the same information but much faster would be massively appreciated.
Many thanks,
Steve