09-30-2013 11:03 AM
I'm using the "Wait(ms)" function in a while loop then read it with the "Tick Count(ms)"function. The value I read is perfectly correct but any time I open or close any other window on windows, I obtain a longer (of about 100 - 200 ms) time. I have a powerful computer that doesn't suffer from any lag.
09-30-2013 11:14 AM
Saying you have a powerful computer is a meaniless term. It depends on OS system calls, the number of threads operating, and whole lot of other factors. My guess you are running windows 7 and not an RT OS which has deterministic response.
09-30-2013 11:24 AM
Windows is a non-deterministic OS. I'm actually surpirsed you are getting consistant ms tick counts. Almost anything can preempt your program: GUI calls, File I/O, network traffic, plugging in a USB device... So if you need a very consistant loop rate, you need to go to a RealTime OS or to FPGA.
09-30-2013 11:28 AM
I am actually running windows 7 but my colleagues also and they don't have the same issue. By saying that I have a powerful computer, I meant that the problem doesn't depend on my CPU or memory usage. Running a memory consuming program on the back would not change anything for instance. Also, if I replace the wait function by a for loop with a random function which takes approximately the same time, I'm not facing this problem anymore.
09-30-2013 11:34 AM
09-30-2013 11:35 AM
As mention, you have a non-determistic OS. You do not know what patches, programs are different, hardware, etc... This all affects the nature of the lags and other. If you insist that it is the same and powerful enough, there is not much people can do for you.
09-30-2013 11:53 AM
Thank you guys for your answers 🙂
I attach the test VI.
My problem is indeed that this delay is very big. If I play a video or use matlab on the back I would see a "noise" of about 3 ms while it's running (plus the peaks of 100-200 ms) at the time I reduce or switch windows.
09-30-2013 11:57 AM
My bad, I actually re-checked and I have no "noise" at all. The time I read is perctly stable expect from when I reduce/switch windows.
10-01-2013 04:49 AM
FYI: I tested your VI on my system, the maximum jitter I have seen so far was around 10ms.
But like the others have said, loop-timing on Windows OS is non-deterministic and depends on the other tasks the scheduler has to handle and their priority.