473,763 Members | 6,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2576
On Feb 22, 11:48 am, "richar...@latt er.demon.co.uk"
<richar...@latt er.demon.co.ukw rote:
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*******@latte r.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_PerfForma ttedData[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...@latte r.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_PerfForma ttedData[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*******@latte r.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
2707
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 T2, T3... try to enter the critical section and are blocked. What is the order that the threads get to enter the critical section?
2
10542
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 the following code that does fire the eventhandlerNewMail, but I don't know how to do the following 2 things... 1. Get the NewMail object so I can look at the mailitems Subject, From etc...
6
1961
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, an TSR that pops a Dialog Box up in the middle of the screen when winword.exe is launched. Any ideas, John
8
8552
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 each object within my JS app to help locate my problem? Thanks
12
5274
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 block protecting a resource. Thread 2 and 3 also have a SyncLock block protecting the same resource and after executing some code in their blocks they both do a Monitor.Pulse to hand of the locked resource back to thread 1. While thread 1 has...
13
5976
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 am not talking about the screen saver, that is something else). I'm very thankfull for answers, but plea, no guesses this time.
5
14816
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 huge problems with slow connect times and heavy resource locking in high concurrency / high transaction volume environments. I have an OLTP with 30-90 transactions per second activity, and start of Health Monitor every 2 hours was crashing our...
4
6976
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 just gotta fix it. I need to make some calculations on the measurements and VB6 is my language. Yes, the system mouse will corrupt the measurement, but it's an auditing function and that's acceptable.
1
3991
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 dialog "myapp has encountered a problem and needs to close..." Checking in the event log we see and event with the following information: Source: .NET Runtime 2.0 Error
0
9564
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9387
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10002
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9823
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.