LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lag Issues When Stopping LabVIEW Code Execution

Solved!
Go to solution

Hello, I am a student studying LabVIEW.
I would like to ask about an issue where the system lags when stopping LabVIEW code after execution.

 

To explain in detail, after running LabVIEW code that collects data and pressing the stop button, the code does not stop immediately, and the screen freezes. The longer the code runs, the longer the screen remains frozen.

 

At this time, as shown in the first picture, the hard disk usage reaches 94%, and the write speed becomes abnormally slow (around a few hundred KB/s).


Since the hard disk is new, I don't think it's a hardware failure.
Is this a common issue? Do others experience this problem as well?

Thank you for reading.

Download All
0 Kudos
Message 1 of 12
(401 Views)
Solution
Accepted by topic author wlsrb2048

It looks like you're writing a lot of data to disk, and it takes time proportional to the data size, so when you stop the LV code, the code and OS are still busy writing the data to disk and, hence, it feels like it stalled and then closes.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 12
(389 Views)

Thank you for your response.
As you mentioned, I am indeed storing large amounts of data.
I was worried about the disk speed degradation and the disk usage reaching 100%, but it seems like everything is functioning normally.
Thank you!

0 Kudos
Message 3 of 12
(378 Views)

You can add Flush File Function to your code, call it time to time to avoid "freezing" at App's close.

Message 4 of 12
(345 Views)
Solution
Accepted by topic author wlsrb2048

The low write speed suggests lots of small and random writes, probably also including opening and closing the file refrence. Is that the case?

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 12
(333 Views)

Your description and pictures are not really useful to troubleshoot the problem.

 

Does pressing the stop button trigger the file saving? (i.e. part of the shutdown code after the main loop?)

What format is the data saved?

How big are the resulting file(s)?

 

Who wrote the program? What is the overall architecture? We probably would need to see your LabVIEW code to offer improved suggestions.  For example you could stream the data to disk as simple binary data.

0 Kudos
Message 6 of 12
(315 Views)

It seems that the case you mentioned is also having an impact. Thank you!

 

0 Kudos
Message 7 of 12
(299 Views)

The files are saved in TDMS format with a size of 700KB, and 120 files are saved over 12 seconds.

I suspect the issue arises due to the large number of files.

I will contact you if further assistance is needed. Thank you for your response!

0 Kudos
Message 8 of 12
(297 Views)

@wlsrb2048 wrote:

The files are saved in TDMS format with a size of 700KB, and 120 files are saved over 12 seconds.

I suspect the issue arises due to the large number of files.

I will contact you if further assistance is needed. Thank you for your response!


TDMS is an effective format, just open the file ref. at start and write them all to the same file. If needed, there are defragmentation tools that can be used afterwards.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 12
(294 Views)

@wlsrb2048 wrote:

It seems that the case you mentioned is also having an impact. Thank you!


This is a long thread with many replies and It is impossible to tell what "case" you are referring to.

Make sure to always quote relevant parts of the earlier post (as I just did here).

 

We still don't know if these 120 files are only beginning to be saved when you stop the program

 

We can also tell that this is a conventional HDD, not a SSD, so don't expect blazing speeds. The maxed out write speed is less than 1MB/s as shown in your image!

 

altenbach_1-1729004253425.png

 

 

0 Kudos
Message 10 of 12
(244 Views)