sergeyb
January 8th, 2003, 03:14 AM
I've encountered a problem determining CPU Usage per process (like Windows Task Manager knows to show).
Anybody wrote such a program?
Thanks for helping.
Anybody wrote such a program?
Thanks for helping.
|
Click to See Complete Forum and Search --> : CPU usage per process sergeyb January 8th, 2003, 03:14 AM I've encountered a problem determining CPU Usage per process (like Windows Task Manager knows to show). Anybody wrote such a program? Thanks for helping. Caprice January 8th, 2003, 08:22 AM GetProcessTimes - the function can halp you. And Richter or MSDN. Just call the function. What to do under Windows'95 I don't know. sergeyb January 8th, 2003, 12:13 PM I tried this one. As far as I got from MSDN, it doesn't compute CPU usage... Thanks anyway. Andreas Masur January 8th, 2003, 03:05 PM Well...you did not specify whether you wanted to have the CPU usage by times or by percentage... :cool: Anyway...I do not have source code since I never did it yet but you can call 'NtQuerySystemInformation()' to get this information. To get some source code take a look at http://www.planet-source-code.com/vb/scripts/ShowZip.asp?lngWId=3&lngCodeId=549&strZipAccessCode=ODE%5F5494157 I am also not sure but as far as I remember this does not split it into separate processes... Caprice January 9th, 2003, 01:43 AM Try to search Perfmon. I have the program with the source code. I think I took it here. As I see you need functions like PdhOpenQuery and so far. dimm_coder January 9th, 2003, 05:35 AM I wrote such type of program for Win NT/2000/XP. U can use such possibilities: 1) As Andreas have already said, U can use NtQuerySystemInformation undocumented function; 2) U can read it from hiden registry hive HKEY_PERFORMANCE_DATA, if U will know it structure; 3) Use PDH library. 4) GetProcessTimes. About 2) and 3) U can read from MSDN. from 1)-3) u can get different info about processes, but from 4) only time (not in % like U can easy get from 1)-3) ). For 9x there are another ways: 1) write vxd driver for getting information; 2) as i remember somewhere in the registry there is keys for all system processor usage ( krnl/user mode), but not for each process. So U have only 1). codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |