Hi.

--- In [email protected], "dleidinger" <[EMAIL PROTECTED]> wrote:
> I noticed, that on a dual-core system 
> GetSystemPerformanceData.Get_CPU_Usage only retrieves the CPU-0 
> values, which is only half of the truth. 

I had a quick look at the plugin-code. get_cpu_usage retrieves
Processor(_Total)\% Processor Time. 
Quote:
...if you have a multiprocessor machine, Processor(_Total)\% Processor
Time actually measures the average processor utilization of your
machine (i.e. utilization averaged over all processors).
http://www.windowsnetworking.com/articles_tutorials/Key-Performance-Monitor-Counters.html

It shouldn't be too difficult to change the plugin, so that you could
add a parameter to get_cpu_usage for the processor number...
 
> machine - now 1,83GHz / Dual-Core / 3GB Ram. So i would like to ask 
> again, if someone could confirm this behaviour, described in my first 
> message (see message-text below).

I can't confirm this but I'm not so much dragging PowerPro-bars
around. I don't see any performance degradation from the plugin. Maybe
it's comes from your color switching code...

> 2. Concerning the dual-core-problem I wanted to test the systemmeter-
> plugin, to see if the CPU-Usage is ok, but unfortunately i am not 
> able to get the systemmeter-plugin to work. Nothing happens.

No idea about systemmeter.

> 3. Another question/idea is, if it is possible to get the CPU-Usage 
> with the DLL-Plugin.

Should be possible. Easiest way might be using pdh.dll, which offers
some helper functions for this:
http://msdn2.microsoft.com/en-us/library/aa373214%28VS.85%29.aspx

Script could look like this:

local err, hQuery, counterPath, hCounter
counterPath = "\\Processor(_Total)\\% Processor Time"
err = dll.call("pdh.dll|PdhOpenQuery|s! ui ui*", "", 0, "hQuery")
err = dll.call("pdh.dll|PdhAddCounterA|ui s ui ui*", hQuery,
counterPath, 0, "hCounter")
win.debug(win.hex(err))
err = dll.call("pdh.dll|PdhCollectQueryData|ui", hQuery)
win.debug(win.hex(err))
wait.for(1000)
err = dll.call("pdh.dll|PdhCollectQueryData|ui", hQuery)
win.debug(win.hex(err))
err = dll.call("pdh.dll|PdhCloseQuery|ui", hQuery)

Unfortunately I can't get PdhCollectQueryData to work. Always returns
PDH_NO_DATA. Don't know why...

Anyway, I wouldn't expect this to perform better than the plugin.

Mockey


Reply via email to