Original Post
🔒 Locked
Timers
Advertisement
Not quite sure what you mean by ''Hiccups'' but it has always worked fine for me. Pay a visit to the NVidia wbsite for a comparison on timing mechanisms - there is source for the timers, and exe file which times the timers (so you can see if it is as accurate as you think).
Hope this helps.
Neil
Hope this helps.
Neil
1. Smooth the timing out if it''s being used as some sort of "elapsed" time between frames. This tends to help a great deal. Smooth over say 10 frames, and also include a trap to stop stuff going crazy if there''s a particularly big delay.
2. QPF() is the most precise platform/CPU independent timer you get in Windows.
3. Any simple "how long did this frame take" timer isn''t going to be totally accurate on a pre-emptive multitasking OS (like Windows) anyway. Your main process thread gets it''s time slice (quantum) which lasts some variable amount (depending on whether you got messages, whether you were starved last time etc). After that timeslice, even if you haven''t finished a frame, control will be snatched away and given to the next scheduled thread in the system.
Another process could end up getting a longer time slice than usual because of some operation or message. You have no control over what they''re doing so your app can be affected by them.
4. Make sure you have one of the "greedy" message pumps so that Windows doesn''t decide your app has gone idle and decide to start some helpful process such the disk defragmenter!
5. Other common "nasty" threads/processes which''ll give your app "hiccups" are the Task Scheduler (which on some machines is checking for Windows Critical Updates every second) and MS Office FindFast (which indexes your HD from time to time).
6. Theres also some things you don''t have control over which are caused by hardware and drivers. Network cards and misconfigured NetBIOS settings are common culprits for stalling the whole machine every so often. As are some HD drivers etc!
7. Final stutter cause is wild memory access patterns. Memory in a virtual memory system is NOT "Random Access Memory" - it''s paged - if a page hasn''t been touched recently you''ll get a page fault. Another name for a page fault is a load from the hard disk. Great for causing stutters in smooth apps. Access memory sequentially, accesses near in time should be near in address.
--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com
2. QPF() is the most precise platform/CPU independent timer you get in Windows.
3. Any simple "how long did this frame take" timer isn''t going to be totally accurate on a pre-emptive multitasking OS (like Windows) anyway. Your main process thread gets it''s time slice (quantum) which lasts some variable amount (depending on whether you got messages, whether you were starved last time etc). After that timeslice, even if you haven''t finished a frame, control will be snatched away and given to the next scheduled thread in the system.
Another process could end up getting a longer time slice than usual because of some operation or message. You have no control over what they''re doing so your app can be affected by them.
4. Make sure you have one of the "greedy" message pumps so that Windows doesn''t decide your app has gone idle and decide to start some helpful process such the disk defragmenter!
5. Other common "nasty" threads/processes which''ll give your app "hiccups" are the Task Scheduler (which on some machines is checking for Windows Critical Updates every second) and MS Office FindFast (which indexes your HD from time to time).
6. Theres also some things you don''t have control over which are caused by hardware and drivers. Network cards and misconfigured NetBIOS settings are common culprits for stalling the whole machine every so often. As are some HD drivers etc!
7. Final stutter cause is wild memory access patterns. Memory in a virtual memory system is NOT "Random Access Memory" - it''s paged - if a page hasn''t been touched recently you''ll get a page fault. Another name for a page fault is a load from the hard disk. Great for causing stutters in smooth apps. Access memory sequentially, accesses near in time should be near in address.
--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com
quote:
Original post by S1CA
4. Make sure you have one of the "greedy" message pumps so that Windows doesn''t decide your app has gone idle and decide to start some helpful process such the disk defragmenter!
What do you mean?
Superpig
- saving pigs from untimely fates
- sleeps in a ham-mock at www.thebinaryrefinery.cjb.net
quote:
superpig:
What do you mean?
He means greedy PeekMessage.
Unlike the GetMessage function, the PeekMessage function does not wait for a message to be placed in the queue before returning.
So if you use GetMessage, Windows thinks, your app is idle and starts thinking now would be a good time to clean house.
Edited by - Abstract Thought on November 23, 2001 12:48:34 PM
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement