Process CPU Time

delphi package - easy access to kernel objects etc.

Process CPU Time

Postby Mazinger » Fri Jun 20, 2008 1:38 pm

Hi,

I need to know the % CPU is using a process (like the taskbar).
How can I do it?

Thanks in advance.
Mazinger
 
Posts: 33
Joined: Wed Jan 26, 2005 6:26 am

Postby madshi » Thu Jul 03, 2008 9:20 pm

Hello,

sorry for the late reply.

There are 2 possibilities for doing this: You can get access to the OS's performance counters. That's quite ugly to do, but works. Alternatively you can use "GetProcessTimes" (or "IProcess.GetTimes"). Call this twice with a delay in between and then you can see the difference between the reported times and calculate the CPU consumption from that information.
madshi
Site Admin
 
Posts: 9265
Joined: Sun Mar 21, 2004 5:25 pm


Return to madKernel

Who is online

Users browsing this forum: No registered users and 1 guest

cron