wine CPU usage and CreateWaitableTimer

andrea mariofutire at googlemail.com
Thu Jul 2 14:40:08 CDT 2015


On 01/07/15 20:43, andrea wrote:
> On 07/06/15 19:08, Sebastian Lackner wrote:
>
> Hi,
>
> I've just tried wine 1.7.45 and things have changed.
>
> Better: the system time has been reduced and it is comparable to CreateWaitableTimer
>
> http://pastebin.com/K55znWFQ
>
> this code check the 4 implementations
>
>
> time ./a.out 2 2
>
> this does a wait every 2 ms for a total of 5 with IReferenceClock
>
> results
>
> real    0m5.090s
> user    0m0.160s
> sys    0m0.214s
>
>
> time ./a.out 2 1
>
> this does a wait every 2 ms for a total of 5 with CreateWaitableTimer
>
> results
>
> real    0m5.157s
> user    0m0.040s
> sys    0m0.115s
>
>
>
> Worse: is the wait is low (guess it depends on CPU speed as well) the actual average wait gets bigger.
> So if I wait for 5 seconds every 1 ms, with CreateWaitableTimer I actually do 5000 waits and on
> average they are 1.00006 apart (it is ok as I asked to do 1 ms wait)
>
> On the other had with IReferenceClock I get an average of 1.30225 ms (it should have been 1)
>
>
> You can use the source code I linked above and compare
>
> ./a.out 1 1        // 1ms wait with CreateWaitableTimer (5 sec total)
> ./a.out 1 2             // 1ms wait with IReferenceClock     (5 sec total)
>
> On an other PC (probably slower) things started getting bad at 2ms wait (which results 2.5ms
> average) and terrible with 1ms wait (9ms on average).
>
>
> So the patch is very good for bigger periods, but not so good for very small periods.
>

Re reading myself, I might have not been very clear.

This patch resolves the issue of the spin lock in IReferenceClock->AdvisePeriodic,

but for small periods the function does not do what it is supposed to do

PC 1:

request wait of 3ms -> get 3ms
request wait of 2ms -> get 2.5ms
request wait of 1ms -> get 8ms

PC 2:

request wait of 3ms -> get 3ms
request wait of 2ms -> get 2ms
request wait of 1ms -> get 1.3ms

while before the patch the actual wait was always the requested
(we are talking about averages over 5 or 10 seconds, of an app that does not do anything else)

Andrea





More information about the wine-devel mailing list