473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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

Feb 22 '07 #1
4 2560
On Feb 22, 11:48 am, "richar...@latter.demon.co.uk"
<richar...@latter.demon.co.ukwrote:
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

Feb 22 '07 #2
ri*******@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
Feb 22 '07 #3
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 <m...@timgolden.me.ukwrote:
richar...@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- Hide quoted text -

- Show quoted text -

Feb 23 '07 #4
ri*******@latter.demon.co.uk 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
Feb 23 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: vooose | last post by:
Suppose execution of a particular thread T1 hits Monitor.Enter(obj); //critical section and blocks at the first line. (ie someone else is in the critical section) Now suppose more threads...
2
by: Roger | last post by:
I am creating an application that will sit on a client pc and monitor the inbox. When an e-mail enters the inbox, then an even will be fired and I will then be able to process the mail. I have...
6
by: Me | last post by:
I am looking for some suggestions or sample code for an application the sits in the system tray (a TSR) and then executes code that I specify when a certain executable is launched. As an example,...
8
by: Adrian | last post by:
Hi I have a JS program that runs localy (under IE6 only) on a PC but it has a memory leak (probably the known MS one!) What applications are there that I could use to look at the memory usage of...
12
by: Perecli Manole | last post by:
I am having some strange thread synchronization problems that require me to better understand the intricacies of Monitor.Wait/Pulse. I have 3 threads. Thread 1 does a Monitor.Wait in a SyncLock...
13
by: Cross | last post by:
I am developing an application that will show movies. When you wach a movie, you do not want the Power Option "Turn off monitor" to be anabled. Is there anyway to fix this from VB.net? (note that I...
5
by: jbenner | last post by:
I have opened a PMR for this with IBM, and am not asking for advice from the DB2 DBA community. I am posting this as an FYI that DB2 Health Monitor, even at the latest version of DB2, still can cause...
4
by: mike | last post by:
I have the opportunity to rescue a project that uses a mouse to sense the relative position of a machine. The hardware is built...just needs to be programmed. Stop snickering!!! I didn't do it...I...
1
by: Grant Schenck | last post by:
Hello, I built a client application using C# .NET 2.0. It runs fine at a number of customer sites. One customer is reporting several users getting problems. At start up it crashes with a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.