LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

writing tdms on cRIO eats 50% of CPU

Hi,

 

I'm currently programming an embedded application on the cRIO 9022. The application basically read inputs and must log data ( around 20 channels, acquired at a 40Hz frequency) on a TDMS file.

 

The problem i'm facing is that tdms writing eats up almost 50% of CPU.

 

I think the issue might be that I write only one point at a time for each channel. What is the best way to do that (performance-wise)?

 

Best regards

 

peper2001

0 Kudos
Message 1 of 6
(2,372 Views)

When you work with file input and output it is always better to write more data at once then write less data multiple times.

For each file call labview has to go through several layers of OS which consumes more time. 

I recommend you to take a bunch of data and write it down once.

CLAD
Passionate for LabVIEW
0 Kudos
Message 2 of 6
(2,366 Views)

Hello,

 

I am maybe a bit late with my personal feedback, but I would just like to provide it.

Writing bigger data sets could  be a good approach to resolve your current issue.

However, do keep in mind that this also has upper limits.

You should keep in mind that the memory footprint of your internal data (+ application) does not become bigger than your internal available memory. (simplified explanation)

 

Also make sure that you are not always reopening and closing your data log file.

This could also give performance issues.

If you plan to continuously write to a certain file, then it might be best to just once open the file, then continuously write to it multiple times and close it when all of your writing is done or your application stops.

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 3 of 6
(2,236 Views)

Hi,

 

For information, I used data value references to make a simple buffer that is written every second to the TDMS file. And CPU usage dropped to something like 15-20%!

 

Thierry, thanks for pointing out the potential issue with the memory usage. Indeed, when the acquisition frequency gets higher, the buffer gets bigger and the memory usage rises. 

 

Best regards,

 

peper

 

 

0 Kudos
Message 4 of 6
(2,231 Views)

Hello peper,

 

It is (like many things in life) always a balancing trick.. Smiley Happy

 

Or to (ab)use a well-known quote:

There is no such thing as a free lunch..

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 5 of 6
(2,207 Views)

reduce file I/O by setting tdms buffersize

0 Kudos
Message 6 of 6
(2,197 Views)