[python-win32] Capturing a Python script's Task Manager statistics
Larry Bates
larry.bates at websafe.com
Fri Jun 20 17:20:06 CEST 2008
python at bdurham.com wrote:
> Anyone know of a way to have a Python script capture its own Task
> Manager statistics?
>
> I have a long running Python script whose CPU, memory, disk i/o, and
> network traffic I would like to monitor.
>
> An alternative more generic approach would be to run an 'observer'
> script that would monitor all Task Manager statistics so I could watch
> multiple scripts.
>
> Motivation: I would like to track this script's resource requirements
> and if the script detects its exceeding some pre-defined resource limits
> for a certain amount of time, to send out an alert.
>
> Any suggestions (or recommendation on a 3rd party that does the same)
> appreciated.
>
> Thank you,
> Malcolm
Suggestion: Convert it to a service and then you can get at the statistics by
hooking the Windows Performance Monitor. Great description of how you would do
this in "Python Programming on Win32" book.
-Larry
More information about the python-win32
mailing list