03-22-2006 02:50 PM
03-23-2006 07:10 AM
03-23-2006 07:58 AM
03-23-2006 09:11 AM
03-23-2006 12:37 PM - edited 03-23-2006 12:37 PM
@Guyver wrote:Good day all,... so i did some investigating and wrote a small while loop function that took the start time, ran through 1000 interations, with the Wait Until Next Millisecond having a 1 as its wait. Now, 1 milli x 1000 interations should give you 1 sec. After subtracting the times, the full loop time was 1.953 seconds.
It is very unusual for an empty test loop to be off by almost a factor of two. This is not my experience.
The example below consistently gives me a time within less than 2% of 1 seconds.
What is your OS? What else is running on your machine? Do you have some fancy hardware (dual core, dual CPU, etc)?
Message Edited by altenbach on 03-23-200610:38 AM
03-23-2006 12:49 PM
Alt,
I implimented your example to see if it would come out with the same result. It did in fact have a resulting time of 1954 ms. Or 1.954s. I did however try a timed while loop instead of a for loop with "wait till next milli multiple" and my time was 1031 consistently. I will probably use the timed while loop for the sake of getting the job done.
There are no other processes going on. I ran this small VI after rebooting. OS is winxp pro, on a dell dimension 9100. I also placed it on a BSI Lunchbox pc, (a built pc with Asus motherboard running win2000) with same results. The orignal did work on one computer correctly, but its an odd case due to the PC being totally pieced together. I.E its running a mobile motherboard, with flash memory and winxp embedded. (i'm not 100% sure of the specs, i only used it as a test case and was not part of the building of this PC)
Thanks for the help.
03-23-2006 04:39 PM
This is actually a known issue and it is actually a Windows limitation. The issue is described in detail in this KB.
Kind Regards,
03-24-2006 11:40 AM
10-23-2019 12:10 PM
Bringing this old post back as recent windows updates have made a huge impact on timed loops. Both LV2017 environment or .exe build has the issue. Windows 7 and Windows 10 both have the issue. Wait, wait until ms, timed loop, ect all run slow at least once within 2hrs, tried everything I can think of. I know this is not real time in windows, but talking seconds of delay here.
So.... I made this do nothing loop (below) to show the issue I am encountering on a program. I call a DAQ bit to toggle every 125ms being read by a piece of hardware to gauge the software is still running, no issue for 3 years, but in the last month the hardware interlock keeps releasing (on several PC's, so not the hardware).
Investigating I found the loop itself was slow, normally within +/-5% of value, but I can get close to 7 seconds execution from this test loop below that really does nothing and uses no resources! It does not matter if I use 1ms or 5000ms as the delay, I still get at least one >6 second loop in a 24 hr period and if i get more than 1000ms the interlock drops out and my test stops. I track the largest delay, thats it, by morning I get 6.2414s on the "time" indicator. No screensaver, no monitor off, no HDD spin down, just started running slow.
10-23-2019 12:31 PM
The basic problem is that while Windows tries to let programs run on schedule, in the end it just runs stuff "whenever", and WILL defer your program if it thinks it needs to.
If timing really is that critical, you need a "Real-Time" operating system.
The best thing I can offer you to try without switching operating systems and see if it helps is to go to the VI properties of the VI where this loop is, and set the "Priority" drop-down to "Time-critical priority (highest)" and hope that helps.
You could also try uninstalling as much bloatware that comes with Windows 10 as possible and see if that helps. I did it mostly to clean up my Start menu, but it seemed to help a bit.