From: nki00 on
> Either way, I meant processors' usage and not processes' usage.
> PercentProcessorTime from Win32_PerfFormattedData_PerfOS_Processor or
> Win32_PerfRawData_PerfOS_Processor (via WMI).
> I hope it help.
>
>
> --
> Regards,
> Jackie


Thanks!

I'll see what this does. Just curious though, how much of an imprint will a
call to those WMI classes put on the system if, say, I do it once every
second or so? I don't want to add too many CPU cycles to just run it, you
know.


PS. I don't think one can edit or remove previous posts.


From: nki00 on
> This approach is used by "ejor" at
> <http://www.codeproject.com/KB/threads/Get_CPU_Usage.aspx>
>
> But he warns that it doesn't give the correct
> results with a multiprocessor system. I didn't
> download his complete code, but he says it has a
> solution for that.

Bob, thanks, but I don't think I want to use something that doesn't work in
multiprocessor environment (that's pretty much every CPU these days :)


From: nki00 on
> See this thread :

I think I found a solution to use NtQuerySystemInformation API myself, but
if you look at its description it looks like they may change it at any time,
so I try to steer clear from functions like that.




From: Jackie on
nki00 wrote:
> Thanks!
>
> I'll see what this does. Just curious though, how much of an imprint will a
> call to those WMI classes put on the system if, say, I do it once every
> second or so? I don't want to add too many CPU cycles to just run it, you
> know.

I understand and agree. I am no expert on WMI but I read that you can
improve performance by reusing the WMI connection somehow or reusing the
locator. It also sounds logical to me that it will be some overhead with
processing the query (parsing the same string and finding what you want,
over and over again). I also read something about the LSASS process
using "a lot" of the CPU under Windows Server 2008 with queries to
remote machines. You could try to benchmark the methods you find (WMI,
that internal function or other ways). I don't really know more than
this, but I am kind of interested in the answer myself.

> PS. I don't think one can edit or remove previous posts.

Seems like it. I guess Thunderbird must be laughing at me for trying the
"Cancel message" option. Had my doubts so at least I was not completely
fooled.

--
Regards,
Jackie
From: nki00 on
> 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.