How can I track/monitor an application and system resources.

Tim Golden mail at timgolden.me.uk
Thu Feb 22 15:07:23 EST 2007


richard_l at latter.demon.co.uk wrote:
> Hello All,
> 
> I'm a newbie to Python!
> 
> I am trying to develop a program that monitors the performance of an
> application.  The kind of information I am interested in is the CPU/
> Process/Thread and memory performance. Specifically, I would like to
> track the following
> 
> CPU usage
> Used Memory on Phone
> Free Memory on Phone
> Number of Processes running
> Number of threads running
> Number of Filehandles currently open
> Memory used by a process/thread
> Process/Thread CPU activity.
> 
> All this under Windows

Not sure about the "... on Phone" bit. Assuming you're
on a supported platform, sounds like you want to look
at the WMI stuff, in particular Win32_PerfFormattedData[1].
There are examples around the web, usually in VBS style.
They're easy enough to translate into Python, either
using the win32com module[2] directly, or using my WMI
helper module[3].

[1] http://msdn2.microsoft.com/en-us/library/aa394253.aspx
[2] http://pywin32.sf.net
[3] http://timgolden.me.uk/python/wmi.html

TJG



More information about the Python-list mailing list