Hi DeLe.
--- In [email protected], "dleidinger" <[EMAIL PROTECTED]> wrote:
> I tested again and i am quite sure, that only the value of CPU-0 is
> returned. How to test: i started MS-Calc and assigned the process to
> CPU-1 (via Taskmanager). Then i entered 999999999 in MS-Calc and
> pressed n!, which brings the CPU-1 to 100%, while CPU-0 has nothing
> to do. But GET_CPU_USAGE just displays a low value. But if i assign
> MS-Calc to CPU-0, then GET_CPU_USAGE displays 100%.
Hmm, interesting. As I said _Total should return the average. But you
never know...
> I also don't drag bars very often. But i drag powerpro-notes quite
> often. It's the same effect for bars and notes.
No delay here with notes either.
> Well that script looks interesting, but i don't understand what's
> going on there.
OK. I got it now. The counter-path apparently has to be in the
system-language (the wonders of Win-API). You have a german system as
well, don't you (das ist gut :-). So you might like to test the
following script on your machine (just a quick hack to get some
data-output, beware of the line-breaks, needs dll-plugin of course):
local err, counterPath0, counterPath1, counterVal, hCounter0,
hCounter1, hQuery, cpuNum, str
counterPath0 = ?"\Prozessor(0)\Prozessorzeit (%)"
counterPath1 = ?"\Prozessor(1)\Prozessorzeit (%)"
counterVal = dll.create_struct("ui[2] i")
err = dll.call("pdh.dll|PdhOpenQuery|s! ui ui*", "", 0, "hQuery")
err = dll.call("pdh.dll|PdhAddCounterA|ui s ui ui*", hQuery,
counterPath0, 0, "hCounter0")
err = dll.call("pdh.dll|PdhAddCounterA|ui s ui ui*", hQuery,
counterPath1, 0, "hCounter1")
for (local i = 1; i <= 30; i++)
str = "processor load:"
err = dll.call("pdh.dll|PdhCollectQueryData|ui", hQuery)
err = dll.call("pdh.dll|PdhGetFormattedCounterValue|ui ui ui t*",
hCounter0, 0x100, 0, counterVal)
str ++= " CPU0: " ++ counterVal[3] ++ "%"
err = dll.call("pdh.dll|PdhGetFormattedCounterValue|ui ui ui t*",
hCounter1, 0x100, 0, counterVal)
str ++= " CPU1: " ++ counterVal[3] ++ "%"
win.debug(str)
wait.for(1000)
endfor
err = dll.call("pdh.dll|PdhCloseQuery|ui", hQuery)
It should display for 30 seconds the load for the 2 CPUs in a
debug-window. If it works on your machine, I can make some improvements.
Mockey