[Tutor] Process Taking more than 10%

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Sun Aug 22 05:49:15 CEST 2004



On Sat, 21 Aug 2004, Asif Iqbal wrote:

> On Fri, Aug 20, 2004 at 04:55:22AM +0100, Alan Gauld wrote:
> > > >There are easy ways to do this on both Unix and Windows and there
> > > >are harder ways. But if its only one OS we might as well stick to
> > > >the easy ways... :-)
> >
> > > I think on linux you would use popen and ps,
> >
> > Nope, the easy way is to use ps and awk...
> >
> > > but how is it done on windows?
> >
> > Assuming NT/W2K/XP
> > Open Task Manager, look at processes and sort by CPU... :-)
>
> I saw in perl a pkg called Proc::ProcessList that has a variable called
> pctcpu that has the CPU percentage of all a process

Hi Asif,


There is a module in SciPy (scipy1.proc) that does it for Linux:

http://www.scipy.org/cvs/viewcvs/map?rmurl=http%3A//scipy.net/cgi-bin/viewcvsx.cgi/scipy1/proc.py%3Frev%3DHEAD%26content-type%3Dtext/vnd.viewcvs-markup

There's another for Windows:

    http://tgolden.sc.sabren.com/python/wmi.html

A strong need for unification exists that has not been filled yet.  At the
moment, I can't find a single Python module that tries to abstract the
process handling of different architectures as Perl's Proc::ProcessTable.
And people have asked for it before:

http://groups.google.com/groups?q=processtable+python&hl=en&lr=&ie=UTF-8&selm=abru9d.3vshe85.1%40kserver.org&rnum=1


Hope this helps!



More information about the Tutor mailing list