Solved

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

Posted on 2001-08-10
9
201 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 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

11 Experts available now in Live!

Get 1:1 Help Now