About calculating cpu and memory usage of each process in VC++
-
Wednesday, December 15, 2010 4:09 AM
Greetings,guys! I'm up to a program that sort of like a mini version of Windows Task Manager. I want to know how to get memory and cpu usage of each process. Any API function?
BTW,I'm totally new in Windows Application programming. just for about a week. plz provide something that make a rookie be able to catch up with! -_^
All Replies
-
Wednesday, December 15, 2010 4:36 AM
Hi,
Please have a look at WMI.
RenJie
-
Wednesday, December 15, 2010 5:33 AM
I've googled a lot and found some infomation about "PerformanceCounter",but obviously I dont know how that works exactly . And I also get a view on WMI in wiki,definitely beyond me.I only have some knowledge about WIN API and MFC lib.
-
Wednesday, December 15, 2010 10:44 AM
- Marked As Answer by teedoo Tuesday, December 21, 2010 2:11 PM
-
Friday, December 17, 2010 2:37 AMModerator
Hi teedoo,
Here is link about CPU Usage in a Multiprocessor Machine
Getting CPU Usage in a Multiprocessor Machine
Hope this information can give you help.
Best regards,
Jesse
Jesse Jiang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

-
Tuesday, December 21, 2010 3:12 AMModerator
Hi teedoo,
I'm very interested in hearing more about your issue, did you solve your problem?
If so please share the solution with us and mark the right answers.
If not please let me know and I will tray to help you find further solutions.
Have a nice day!
Jesse
Jesse Jiang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

-
Tuesday, December 21, 2010 2:11 PM
Sorry,guys for no reply being a while
I've had my problem solved.I got memory usage as Nikita Leontiev pointed out.Only one problem,the result of memorywoekingset is always larger than that in the Windows Task Manager.And I got cpu usage by querying "ntdll.dll",which I was told by my friend.
Anyway,Thanks to you all.
teedoo^-^
-
Tuesday, December 21, 2010 2:18 PMMaybe you will be interested in this memory monitor sample.
Nikita Leontiev

