Jesús Gabriel y Galán <jgabrielygalan_AT_gmail.com> wrote:
>
> I was trying to modify the status bar to add cpu % usage. The easiest
> way I found (or so I thought) was this, which works in the command
> line:
>
> jesus_AT_localhost:~$ top -n 1 | awk 'NR==3 {print $2}'
> 1.9%us,
>
Eugh, that truly is horrible.
Have a look at /proc/stat and section 1.8 of
Documentation/filesystems/proc.txt in the Linux kernel tree.
To be honest, getting CPU 'usage' is pretty pointless as it's either
busy, idle or busy waiting on IO. You should be using loadavg really
as instantaneous CPU usage tells you nothing.
Regards
-- Alexander Clouter .sigmonster says: People humiliating a salami!Received on Tue May 05 2009 - 17:50:07 UTC
This archive was generated by hypermail 2.2.0 : Tue May 05 2009 - 18:12:07 UTC