Solved

How do I programmatically find the CPU usage of another process in Windows NT & W2K?

Posted on 2001-08-10
9
204 Views
Last Modified: 2013-12-03
How do I programmatically find the CPU usage of another process in Windows NT & W2K?
I want to delay my processing based on the CPU taken by a co-process. Both the processes are COM services.
Wondering how the Windows Task Manager or performance Manger does it!


0
Comment
Question by:Sanjoo
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6378662
0
 

Author Comment

by:Sanjoo
ID: 6378688
Thanx, but..
I wanted to find the CPU usage of 'a particular process' at the current time and not the total CPU usage at the current time.(in Win NT & W2K) The CPU is of the Intel family of processors.

PS> I already have the Codepile.com stuff with me but it gives the total CPU usage only.

0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6384598
Or, you want for every thread. In such case see
http://www.edm2.com/0607/cpu.html
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 50 total points
ID: 6417791
I hope, code from my comment helps. Alex
0
 

Author Comment

by:Sanjoo
ID: 6418160
That solution is only for OS/2 Warp I guess as the article goes. I wanted one that works for WinNT 4.0 and Win2K both!
I guess I mentioned it.

The article talks of only OS/2 Warp 3.0 and 4.0 nothing Microsoft about it!

Moreover I cannot use undocumented features in windows for the fear of future compatibilty.

Also, I am nearing on another different solution here, hopefully it should be over this week.

Thanks.
0
 
LVL 3

Expert Comment

by:Melange
ID: 6666462
The information you want is in the performance counters of the system. There are API functions for reading this. Unfortunately they're not the most intuitive. There were some articles using performance counters recently in MSDN/MSJ magazine. Try searching the knowledge base at http://msdn.microsoft.com for information on reading performance counters. Incidentally you can also create your own counters if you have the need.

I'm sorry this isn't much help, but I haven't had the need yet to do this myself, so I don't know the specifics. But at least this should point you in the right direction.
0
 
LVL 3

Expert Comment

by:Melange
ID: 6666476
Come to think of it, the articles I was thinking of were in Windows Developers Journal, but here are some similar articles from MSJ:

Part 1: general and for VB
http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0398/hood0398.htm

and

Part 2: more specifics and for C/C++
http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0598/hood0598.htm
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6697018
If this proposed answer has helped you, please accept it, grade it and close this question.  If it is not, reject it and add comments as to your progress and what else is needed.

Thanks,
Moondancer
Community Support Moderator @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6791209
Zero response from Asker or expert(s) since my last follow up request, therefore can only assume that the Proposed Answer served the need.  Closing today.

I am sorry to see that Asker has not returned to update and finalize this question.  I am, therefore, force accepting this question.  In the event the Asker returns with additional needs related to this question, please respond and continue the collaboration process.
 
If there are questions in this regard, please comment and I'll return when I can.
 
The HELP DESK link on the left is informative, and includes this site's Guidelines and Member Agreement as well as assistance related to Questions and Answers.  Here is the QA link, as a reference.
 
http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp

--->  While I'm here anyway, letting all know that we have added quite a number of new Topic Areas, as you'll see from the link below:

http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Community Support Moderator @ Experts Exchange
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question