How to get the CPU time?

C, C++, Visual C++, C++.Net Topics
Post Reply
User avatar
Kevin
Sergeant Major
Sergeant Major
Posts: 40
Joined: Sun Jul 19, 2009 7:49 pm
Location: Sydney

How to get the CPU time?

Post by Kevin » Fri Jul 31, 2009 3:50 pm

Hi,

Is there any way to find the CPU time which is displayed in Idle Process ?

Regards,

Kevin
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: How to get the CPU time?

Post by Neo » Fri Jul 31, 2009 3:53 pm

Hi Kevin,

You can do it as follows.

Code: Select all

NTSTATUS hStatus;
SYSTEM_PERFORMANCE_INFORMATION sysPInfo;

hStatus = NtQuerySystemInformation(SystemPerformanceInformation, &sysPInfo, sizeof(sysPInfo), NULL);
if (hStatus != NO_ERROR){
       // Your code here
}
BR,

Neo
Post Reply

Return to “C/C++ Programming”