LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Monitor CPU usage in labview RT 8

Hello,
I would like to implement in our real-time application an indicator to display the cpu usage of the PXI8196 controller, as it is done with the real-time system manager.
 
I already do a custom cpu monitoring with a while loop running forever in background priority within the real-time application. It works quite well but uses all available cpu resources and that slows down system tasks, as FTP transfer for example. However, Real-time system manager does not affect these tasks.
 
How does CPU usage monitor program works ? Is there some functions somewhere to estimate CPU usage in LabVIEW RT 8 ?
 
 
Thanks for help.
0 Kudos
Message 1 of 7
(5,810 Views)

Before considering how the cpu monitor works, I am curious...  In your while loop, do you have a delay?  If not, try placing a delay even as small as 10ms (actually Dennis recommended a value as small as 0ms).  This will free up the cpu momentarily (for other tasks, etc) and may appear to improve performance.

JLV

Message 2 of 7
(5,801 Views)
Hello Joe,
 
I initially did not have any delay in this while loop. As it was set as background priority, I imagined it would not disturb the rest of the system.
I already tried to use a 0ms delay, but this does not improve FTP so much. 50ms works much better, and that is the value I currently use to allow faster FTP transfers.
I compared my CPU usage estimation to the one provided by NI tool. It gives similar results, but not exactly the same, that is also why I would like to know how to use the same mechanism.
 
I saw that the real time system manager only refresh CPU usage down to 1s rate. Is there another way to perform it faster ? I need at least 100ms resolution to perform accurate benchmarks.
0 Kudos
Message 3 of 7
(5,792 Views)
Inpriser, I'm curious how you implemented your CPU monitor.  I would like to add a CPU monitor to my RT application without using the RT System Manager, but I'm not quite sure how to implement one.  Are you using features specific to labview 8?  My application is in labview 7.1.1 currently.  Thanks.
0 Kudos
Message 4 of 7
(5,712 Views)

I used a simple way to estimate it : before starting the application, I just  perform some calculations in a for loop 1000000 times and I measure the time spent doing that (using tick count function before and after the loop). This duration is taken as reference for 0% CPU usage (Tref).

Inside my application, I have a while loop running all the time but with a VI in background priority, performing the same calculations as initially (the loop with 1000000 cycles). Time needed to compute the operations, in parallel of the rest of the application is stored in Tcurr. CPU load is estimated by doing (1-Tcurr/Tref)*100.

I compared this estimation with the value given by the real time system manager : it does not match exactly, but they are quite similar.

Please note that when running this while loop forever, it leads to monitoring 100% CPU activity through the real time system manager, but actually, when VIs in my application need to execute, there is no problem since my CPU estimation VI has background priority. Nevertheless, I perform this estimation only every 100ms, because I felt it had negative impacts on controller system tasks (buid-in FTP server for example).

If there is any other solution to retrieve the CPU load, like a system function available in Pharlap, I also would be interested to know it.

Hope it helped.

0 Kudos
Message 5 of 7
(5,698 Views)
Has anyone ever tried this tool?

Monitoring the CPU Usage of a LabVIEW Real-Time Target

http://zone.ni.com/devzone/cda/epd/p/id/4713


Regards

Stephan A.

NI Germany
Message 6 of 7
(5,011 Views)
Hi Stephan,

I have been using this library since version 7.0, it usually gives a good indication of how much % of CPU utilization without going through the Real time system manager and embed this within your main VI. (Obviously as another task with a little delay~500-1000ms). I feel its a bit lighter in terms of overhead because it bypasses the RTSM.

 I am not sure that if the memory manager usage lib also exist any longer because I haven't stumbled across it for Labview 8.x.

Regards,
Ashm01


0 Kudos
Message 7 of 7
(5,004 Views)