Welcome to the Lounge
The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
|I am using something like
toWait is dynamic, depending on frequency and desired time minus the used time for the data processing.
I am aware of:
Blocks the execution of the current thread for at least the specified sleep_duration.
This function may block for longer than sleep_duration due to scheduling or resource contention delays.
but I would at least have expected that the scheduling or resource contention is something that can come but that goes again as fast as it gets solved but...
NO, it isn't.
1 minute à 250 Hz (4 ms period) --> 15000 expected ticks.
toWait = [3700, 3980] us depending on what it is done in each tick
30% of the tests working fine, sleeping the correct toWait --> 60.000xxx execution time, 15001 ticks
70% of the tests going wrong, because it adds 6 ms to the wait time (toWait [9700, 9950] us) and the elephanting offset remains for the whole execution --> 60.000xxx execution time, 6001 ticks
Sorry... but I had to "shout"
Thanks for "listening"
EDIT (New day, new perspective):
I have just dumped the
I am now using my own check using the QueryPerformanceCounter and comparing it to the period I want to use.
So far... performing good.
If my long time performance tests are successful and I get the time to do it right... I might put a bit order, create a helper class and write an article / tip about it.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
modified 25-Apr-19 3:30am.
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.