[vlc-devel] [Patch] Windows Timer Precision, Ticket #264

Andre Weber WeberAndre at gmx.de
Mon Feb 25 20:03:32 CET 2008


so durring the tests of my changed waveout I have found - with no problems when,
switching to multimedia timers - with a better precision, the call "timeBeginPeriod" durring
initializing - changes the precision to 5ms, this has influence on the following windows
sleep( ... )  - will wakeup more precise
WaitForSingleObject(...) -- reduced latency between Signal and Wakeup
timeGetTime() - has now a 5ms resolution - and allows better time measurement in case
of unrealiable high precision counters.  -- with the precision counters we hit the next problematic
stuff -- on dual cores Microsoft and the Bios manufactureres doesn't get it done - to initialized
both cores to the same timer values -- this may leads to funny effects - because threads
may be moved from one core to another core -- and the time returned there may differ -
with terrible results? --- to avoid this - you have only two options - force VLC to run
only on one core - thats not nice? -- or to not use the High precission timers.
I decided to add some more code to mtime.c - to test if the current PC has more than one
core - and disable the use of the HPT in general if cores_count > 1

The change of time precision with timeBeginPeriod(..) also has influence on the
windows task scheduler - so far I understand - and leads to a little more CPU utilization
- if the value passed to timeBeginPeriod(..) is too small -- its possible to force 1ms precision
- but this increased CPU usage too much -- may be 10ms will also be sufficient - but
we should try for the first time to use 5ms and see whats happend.
The influence on the scheduler - leads also to faster wakeups after signals have arrived,
(so far I understand this windows core stuff right ...)

So I would like it to see - that we give it a try?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: timers.zip
Type: application/x-zip-compressed
Size: 1773 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20080225/83b43f7f/attachment.bin>

More information about the vlc-devel mailing list