Solved

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

Posted on 2001-08-10
9
202 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
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 50 total points
ID: 6417791
I hope, code from my comment helps. Alex
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now