Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How can I track/monitor an application and system resources.

Reply
Thread Tools

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

 
 
richard_l@latter.demon.co.uk
Guest
Posts: n/a
 
      02-22-2007
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

Can anyone help me, or direct me to the appriopriate API's so I can
get the above information?

Does anyone have any other sugestions on what else I could monitor for
a running application?

Does anyone have any example code they can direct me to?

Many thanks in advance,


Richard

 
Reply With Quote
 
 
 
 
Jordan
Guest
Posts: n/a
 
      02-22-2007
On Feb 22, 11:48 am, "(E-Mail Removed)"
<(E-Mail Removed)> 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
>
> Can anyone help me, or direct me to the appriopriate API's so I can
> get the above information?
>
> Does anyone have any other sugestions on what else I could monitor for
> a running application?
>
> Does anyone have any example code they can direct me to?
>
> Many thanks in advance,
>
> Richard


You will definitely want to check out pywin32api, because it is the
best (and most powerful) way to interact with windows through python.
Also, if you know any c++, you might search for taskmanager extensions
on codeproject.com or look at the msdn on taskmanager to see how it
gets all of its information (which is essentially what you want -- a
taskmanager). Either way you'll almost defitely need pywin32, so look
there first.

Cheers,
Jordan

 
Reply With Quote
 
 
 
 
Tim Golden
Guest
Posts: n/a
 
      02-22-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) 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
 
Reply With Quote
 
richard_l@latter.demon.co.uk
Guest
Posts: n/a
 
      02-23-2007
Hello,

Many thanks for your advice so far!

The phone reference is actually because the target device is WM 5.0.
I've found a python port Pyce that will run on this platform. We have
a target application that runs on this platform which we would like to
develop some automated tests for. The application is written in VC++
and we're using python to stress test it!

Many thanks again!

R.

On 22 Feb, 20:07, Tim Golden <(E-Mail Removed)> wrote:
> (E-Mail Removed) 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- Hide quoted text -
>
> - Show quoted text -



 
Reply With Quote
 
Tim Golden
Guest
Posts: n/a
 
      02-23-2007
(E-Mail Removed) wrote:
> The phone reference is actually because the target device is WM 5.0.
> I've found a python port Pyce that will run on this platform. We have
> a target application that runs on this platform which we would like to
> develop some automated tests for. The application is written in VC++
> and we're using python to stress test it!


You'll have to investigate a bit to see what APIs are
available for the platform. I'm afraid I've no experience
with portable devices, but some of my colleagues who've
done embedded database work on GPRS scanners tell me that
the API is quite cut-back.

Apart from WMI -- which could well not be there -- there
are also the Performance APIs which are exposed by pywin32
in the win32pdh module. Again, though, you'd have to check
if they're supported.

TJG
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Can't access internet with 32 bit application on x64 system. steadar Windows 64bit 2 09-29-2006 02:45 PM
System.Security.SecurityException: Error de solicitud de permiso de tipo System.Net.WebPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. Luis Esteban Valencia ASP .Net 0 07-14-2005 01:43 PM
Hi I have one web application and i want to get the number of users who are currently accessing the application. Also I want to get the user details of each user, which is stored in a database. How can I do this? Pls help. Getting No: and anu Java 11 05-12-2005 03:25 PM
How to control user account can't login system twice at the same time in Web base system?? Lawrance ASP .Net 0 11-30-2003 09:56 AM



Advertisments