12-21-2024 05:56 PM - edited 12-21-2024 06:17 PM
@PasiSalminen wrote:
Hi,
I have similar observation/problem. The effect is same (VI CPU load drops when minimized), but result is unwanted.
I made a VI to demonstrate this. On the FP you can see that the time between while loop iterations is 2ms when the VI is frontmost application on windows. But when I switch e.g. to web browser, then after a short while the delay between while loops jumps to 15ms. Then I change back to labview and the delay drops back to 2ms.
How to fix this? I have a feeling this has something to do with the wait(ms).vi, how I can replace it? I think operating system is altering the 1ms ticks.
I have windows 11 and LabVIEW 2017.
Would everyone else please allow me a minute.
First, there is a single thread in your OS devoted to updating the user interface. It is called the UIThread. That SINGLE operation thread is responsible for every thing the USER may be exposed to.
Graphs , charts and every other Front panel object need a buffer between the data and how the data is displayed to the user. Are you with me so far? That buffer is known as a transfer buffer and it does catch everything that the dataspace from your program needs to present to the user. That takes some time and a switch to the Single 'Ui' thread.
I don't want to risk a "tldr" here. Let us know what you think the OS should be doing differently.
You(THE DEVELOPER) need to be aware That the the OS proirtizes the USER. Often, the USER is not around the data display, or even worthy of evaluating the current dataspace values!
12-22-2024 02:29 PM - edited 12-22-2024 02:32 PM
@PasiSalminen wrote:
How to fix this? I have a feeling this has something to do with the wait(ms).vi, how I can replace it? I think operating system is altering the 1ms ticks.
I have windows 11 and LabVIEW 2017.
We cannot debug images, especially if we need to guess what's in the other cases of the case structures. Please attach your VI instead.
Also be aware that LabVIEW 2017 is not officially supported under Windows 11 , so all bets are off anyway. I would be happy to test under a newer version.
If you really need more precise timing, use a timed loop. It will even tell you if it cannot keep up.
Does the same happen if you use less convoluted code?
For example....