ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

DONE: Replacement Power Options applet

<< < (5/9) > >>

Carol Haynes:
Scratches head .... yes I think I understand that ...  :tellme:

f0dder:
Okay, let me try... you were in the right direction, Farmsteader :)

the code runs once every second, and measures:

1) how many miliseconds elapsed since it last run (tick-tick0). This might seem superfluous, but it CAN vary a bit, since the code runs at normal priority.

2) how much time the CPU was idle (the value from GetSystemTimes) (again, a relative timing, idletime-idletime0).

Thing is, GetSystemTimes returns totals for all CPUs - so on a 2-core system, although only one second has elapsed, 2 "cpu-seconds" could be spent idle, and this is why we have to divide by NUMBER_OF_PROCESSORS.

The affinity thing is anyother problem, and I'm not sure it applies here (can't remember if it affects GetTickCount(), or only the RDTSC CPU instruction and the win32 api QueryPerformanceCounter()). But that problem happens on AMD dualcore CPUs, because their internal time-stamp counters aren't synchronized (while on intel dualcores it seems like either there's a single TSC, or the TSCs are synchronized).

skrommel:
 :tellme: Anyone care to test LowToSleep v1.3?

- 20070118 - v1.3: Retrieves the number of processors for correct calculations on multi core systems.

Skrommel

Carol Haynes:
Ah ! Now that seems to work for me (at least for reporting CPU usage). Thanks that's great.

I'll try it out now for allowing sleeping on sustained low CPU usage.

skrommel:
 :D Great!

Thanks for finding the solution, f0dder!

Skrommel

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version