LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

100% CPU usage

Hi,

I have a data acquisition system which reads data from four probes and then plot them. First I open references to the four graphics and I update them each 5 seconds and I acquire data from the four probes each 200ms (I have a loop). Moreover I have a thread that save the state of the process each 5 minutes because if the systems fails I can restart it and continue doing what I was doing before system failed or crashed. During the execution of this process, I also save data of the four probes each 5 seconds. All the data is saved in a MySQL database and I only open a connection to it and I use it during all the process, I don't open more connections, I always use the same opened connection in order to increase performance but it is true that a lot of threads can save data to it at the same time (concurrently).

Well, my problem is that at the first, when I launch my data acquisition system, it only uses from 4% to 8% of CPU but the CPU usage increases each time until it reaches 100% of CPU usage after 20 minutes. Why?

Thanks,

ToNi.
0 Kudos
Message 1 of 21
(4,960 Views)
Hello ToNi,

from your description I would guess you are collecting your data in arrays. Those arrays are growing with time and LabView has mainly to cope with memory management - increasing CPU usage to ~100%.
Maybe a look at your VI might give more detailed answers...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 21
(4,949 Views)

Gerd wrote

"Maybe a look at your VI might give more detailed answers... "

No don't post the code, that would take away all of the fun of guessing! Smiley Very Happy

Seriously, Gerd is correct in that we can do much better with code to look at.

But until then...

I think Gerd's suspicion of building arrays is a good one.

I will guess it is the plots. Eliminate the plot updates and see how it runs.

 

Have fun,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 21
(4,945 Views)
Hello,
My problem as said GerdW was that I have four vectors which grew to infinite. I have solve it and I put a limit in the vectors. Now each vector has a dimension of 86400 points. Now the CPU usage increases more slowly to 100% but finally, after 1 hour it reaches 100% CPU usage again but GerdW had reason. I think I have a vector that grows to infinite somewhere, I look for it.... also I'll try to do what Ben says... and later I'll tell us something about.

Sorry, my code is more bigger, but I try to post here a piece of it ok?

Thanks,

ToNi.
0 Kudos
Message 4 of 21
(4,832 Views)
Hi again,

As Ben said the problem is the plot updates.....

Well I have four plots running in state hide and they appear when the user presses a button, in other words, when user presses button temperature appears the plot of temperature, when the user presses button oxigen appears the plot of oxigen and so for the other two plots.

The plots are waveforms charts and their history length is 86400. Each plot has a history length of 86400 because I want to plot data of 24hours (a day) and each data is taken each second. Each second I take 4 points: temperature, oxigen, redox, pH and I send them to its respective graph, for example, temperature to temperature graph, oxigen to oxigen graph.....

What is the problem? the history length of the charts? What can I do?

Thanks,

ToNi.


0 Kudos
Message 5 of 21
(4,912 Views)

DF Gray wrote this KB article

https://forums.ni.com/t5/Example-Code/Managing-Large-Data-Sets-in-LabVIEW/ta-p/4100668

that gives you a lot of useful info on how to handle this challenge.

 

RE: history of 86400

Unless you have a display that is 86400 pixels wide, LV is doing a lot of work to display the data. The KB above cited touches on this issue and shows you how to make it look like there is more data there than there really is.

With that much data updated every second, things like "point style" "Auto-scaling" Interpolation" can help or hurt.

Have fun,

Ben

 
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 21
(4,906 Views)
Hi,

This dll is in LV 7.1 and I use LV7. I can't open it and.... Is the history length of a chart  the number of point of that chart? If I put a history length of 10, the chart will contain 10 points in X-axis? If not, how can I tell LV that I want the chart has 86400 points in X-axis? How can I represent It?

Thanks,

ToNi.
0 Kudos
Message 7 of 21
(4,904 Views)
I use Autoscale X in all plots and then If I tell LV the history length is 86400 for each plot......LV plot it using autoscale X and LV try to plot all the 86400 points there no?

Thanks,

ToNi.
0 Kudos
Message 8 of 21
(4,895 Views)
What you need to do is de-couple the data presentation from the raw data.  Try plotting only one value per minute.  You can store these values in an array with a size 1440 (minutes per day).  Generating the values per minute is easy, but you can do it in at least two ways.  The easiest is to simply take every Nth data point and pass it to the plot.  This way you are losing some information, but if your observed changes are slow, it will be sufficient.  The other way is to generate an average over each minute.  To do this you need a buffer of 60 values (Assuming an acquisition rate of 1Hz) which is averaged at the end of each minute and sent to the plot.  After averaging, you can either empty the array again.

Please note that these suggestions are parallel to the ACTUAL data storage.  In thebackground (not actively displayed) you should still save every point of course, but the user doesn't actually NEED to see this.  It's far mroe efficient to seperate the two processes.  As mentioned previously, I'm not aware of a display which will actually show 86,000 data points.  I'd love to see the graphics card that could handle that!

Hope this helps

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
Message 9 of 21
(4,864 Views)
Message 10 of 21
(4,848 Views)