Gauging system load

Bryan Mongeau bryan at eevolved.com
Thu Feb 15 07:35:48 EST 2001


Out of curiosity, does anyone know of a module or a neat trick that will 
permit me to gauge the system load at a given time? For example, in a 
utopian dream world:

import sys, time

# A percentage value
THRESHOLD = 20

while 1:
  if sys.cpuActivity <  THRESHOLD:
    # Do some heavy work
    break
  else
    time.sleep(10)


I've thought of maybe spawning a thread and gauging the amount of time it 
takes for it to be serviced, but that's pretty crude and innaccurate.

Any tips?
-- 
<==================================>
Bryan Mongeau
Lead Developer, Director
eEvolved Real-Time Technologies Inc.
http://www.eevolved.com
<==================================>

"I want to know God's thoughts; the rest are details."-- Einstein




More information about the Python-list mailing list