Best way to run multiple Python processes without overloading CPU or disk i/o

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Dec 8 02:48:19 EST 2008


En Wed, 03 Dec 2008 02:29:32 -0200, Philip Semanchuk
<philip at semanchuk.com> escribió:

>
> On Dec 2, 2008, at 11:21 PM, python at bdurham.com wrote:
>
>> Is there a cross-platform way to launch multiple Python processes
>> and monitor CPU usage
>
> os.getloadavg() might be useful. It certainly works on *nix, don't know  
> about Windows. The documentation doesn't mention any platform  
> limitations.

....apart from saying "Availability: Unix."? :)

To the OP: You may monitor CPU usage using the Tim Golden's wmi module [1]

py> import wmi
py> c = wmi.WMI()
py> for p in c.Win32_Processor():
....   print float(p.LoadPercentage)
....
9.0

[1] http://timgolden.me.uk/python/

-- 
Gabriel Genellina




More information about the Python-list mailing list