On Wed, May 6, 2009 at 10:49 AM, fugou nashi <[email protected]> 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.

Reply via email to