[ILUG] cpu idle time

From: Mel (mel at domain csn.ul.ie)
Date: Mon 24 May 1999 - 21:45:00 IST


This is probably all wrong but would this give you the total used time?
Quantum leap to get the procent idle time from it.

#!/bin/bash
for i in `ps auxf | awk '{ MEL = MEL + $3; print MEL }'`; do
  IDLE=$i
done
echo Idle time: $IDLE

it sums the third field of ps which is %CPU.

Points about it
1. Yes - I know it shouldn't need to print out over and over again but it
         was the easiest thing to do on short notice.
2. Yes - I couldn't be bothered to think of a better variable name than
         $MEL

        Mel

On Mon, 24 May 1999, Ger Gorman wrote:

> ok, I'm trying to get the %CPU idle from a script (as in obtain its value
> ....$idle_cpu). Now my first thought was to assign the output of

<snip>



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:04:13 GMT