Re: [wmii] Adding cpu usage to status bar

From: Jesús Gabriel y Galán <jgabrielygalan_AT_gmail.com>
Date: Wed, 6 May 2009 13:56:28 +0200

On Wed, May 6, 2009 at 10:49 AM, fugou nashi <fugounashi+wmii_AT_gmail.com> wrote:
>> Anybody can give a hint at what might be going on, or have a better
>> idea on how to show the cpu % usage?
>
> you should use ps rather than top

>        string=`ps -eo pcpu,ucmd --sort -pcpu|tail -n +2|awk 'BEGIN
> {ORS=" "}; $1 > 50 {print $2 " " $1}'`

Hi,

I liked this idea better, so I settled with this:

# Status Bar Info
status() {
        echo -n $(acpi) '|' $(ps -eo pcpu,ucmd --sort -pcpu | sed -n
2,4p | awk '$1 > 10 {print $1 " (" $2 ")"}') '|' $(uptime | sed
's/.*://; s/,//g') '|' $(date)
}

I'm showing the first 3 processes if they happen to be using more than 10%.

Thanks to all who contributed to this discussion.

Jesus.
Received on Wed May 06 2009 - 11:56:28 UTC

This archive was generated by hypermail 2.2.0 : Wed May 06 2009 - 12:00:08 UTC