From: Jackie on
nki00 wrote:
>> I don't really know more than this, but I am kind of interested in the
>> answer myself.
>>
>
> Thanks, Jackie. If I find more info I will post it here.
>
>

Thank you as well. :)

--
Regards,
Jackie
From: Dee Earley on
On 05/06/2010 00:06, nki00 wrote:
> Hi everyone:
>
>
> I've been struggling to come up with a correct code to determine CPU usage
> on the Windows-based system. So far I came up with the following. The code
> is called internally from WM_TIMER message that is called once every 100
> milliseconds, but if compared with the Task Manager's CPU usage, it does not
> always match. What could be the reason for that?

How different is it?

CPU usage is an instantaneous value so two apps querying it will show
roughly the same profile but may well give different values.

--
Dee Earley (dee.earley(a)icode.co.uk)
i-Catcher Development Team

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)
From: nki00 on
> How different is it?
>
> CPU usage is an instantaneous value so two apps querying it will show
> roughly the same profile but may well give different values.

It's not that much different most of the times, but sometimes the Vista
gadget will spike up when my app still shows a much lower value. But I agree
that it's very hard to debug.


From: Jackie on
However, I do understand that you won't get per-processor or per-core
usage info with GetSystemTimes.

--
Regards,
Jackie
From: Jackie on
I just came over this:
http://www.prosyslib.org/

There's a class calld PSLProcessor:
http://www.prosyslib.org/Help/ProSysLib~PSLProcessor.html
There's a "Usage" member there as well.

I think the class should work on Windows 7 as well (the latest update
says something about Windows 7 so I would assume everything else works
on Windows 7 as well).
I saw some comments on Code Project by the author of this library, and
it seems like the internal function may be used. It's open source so
least you can have a look on the inside.

The library looks pretty interesting to me, actually.

I am interested in exactly how the API GetSystemTimes is not giving the
right info as said in the article mentioned earlier on Code Project,
since it says on MSDN "On a multiprocessor system, the values returned
are the sum of the designated times across all processors".

--
Regards,
Jackie