LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

wait(ms) function lags when opening any window on windows

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.

0 Kudos
Message 1 of 9
(3,319 Views)

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.

0 Kudos
Message 2 of 9
(3,313 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 9
(3,306 Views)

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.

0 Kudos
Message 4 of 9
(3,302 Views)
Please post your test vi's. Even with windows being non deterministic I rarely see this much delay or jitter
0 Kudos
Message 5 of 9
(3,294 Views)

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.

0 Kudos
Message 6 of 9
(3,293 Views)

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. 

0 Kudos
Message 7 of 9
(3,281 Views)

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. 

0 Kudos
Message 8 of 9
(3,279 Views)

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. 

__________________________________
Certified LabVIEW Associate Developer
0 Kudos
Message 9 of 9
(3,228 Views)