====== 13 Performance Monitoring ====== [[kb:labview:tools:perf-mon|Click Here]] for information about performance monitoring on windows. ===== Memory (RAM) ===== Because of the specific memory management of Linux it is not so obvious how much memory is in use and how much is free. A common pitfall is the use of the System Property Node ''FreePhysMem'' to get the amount of memory LabVIEW (or other programs) could use. Linux uses extensive buffering of IO-operations that can lead to a huge memory usage. In this case ''FreePhysMem'' will show a very low value (about 16 MB seems the minimum Linux holds back), but there is probably much more memory available if some process asks for it. {{:kb:ni-rt:linuxrt:pasted:20230413-083351.png}} To get more detailed information about the memory on a Linux machine the best way it to read the (virtual) file ''/proc/meminfo'' (e.g. with ''cat /proc/meminfo'' on the Bash). A lot of the content is really complicated operating system stuff, for more information see https://access.redhat.com/solutions/406773. {{:kb:ni-rt:linuxrt:meminfo1.png|Typical output of the file /proc/meminfo}} Most relevant are the fist three lines: * ''MemTotal'': Total physical memory (same as ''TotalPhysMem'' in the System Property Node) * ''MemFree'': Memory not used by anything. Probably this is the value ''FreePhysMem'' in the System Property Node returns. This memory gets consumed from IO-buffers with the time. * ''MemAvailable'': Is the amount of memory that a process or whatever can allocate until the memory is "full". This is probably the best value to determine the //free memory// on a Linux machine. Example output of ''/proc/meminfo'' after the cRIO did a lot of IO-operations and the memory is consumed by the Buffer: {{:kb:ni-rt:linuxrt:meminfo2.png|Typical output of the file /proc/meminfo}} //HSE Internal:// For easy accessing the Linux memory info from LabVIEW there is a VI ''Get Linux MemInfo.vi'' in the project //HAGEMONITOR-MASTER//. This VI returns all ''meminfo'' content as attributes of a variant. In the future this VI could go into a //RT-Tools//-library. ==== LabVIEW's Memory Footprint ==== A tip courtesy of fellow LabVIEW friend [[https://www.linkedin.com/in/felipepinheirosilva/|Felipe Pinheiro Silva]]: You can read out the amount of memory that the LabVIEW real time application uses. cat /proc/$(pidof lvrt)/status | grep VmRSS ===== Real Time Trace Viewer ===== Unlike the DETT, the Real Time Trace Viewer only shows timings. //Tip: Have a second project which only contains the components of the code, which are also runnable under windows and use the DETT.// ==== Getting started ==== - place Start and Stop Trace methods in your code - make sure firewall rules allow communication - start Realt Time Trace Viewer - start the RT-Application {{:kb:ni-rt:linuxrt:pasted:20230413-082537.png}} {{:kb:ni-rt:linuxrt:pasted:20230413-082456.png}} {{:kb:ni-rt:linuxrt:pasted:20230413-082702.png}} ===== Additional Resources ===== * [[https://forums.ni.com/t5/LabVIEW-Champion-Discussions/Determinism-jitter-and-timed-structures-on-RT/m-p/4151733#M32515|NI Champions Forum: Determinism, jitter and timed structures on RT]] * [[https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHdDCAW&l=de-DE|Monitoring CPU and Memory Usage on Real-Time Embedded Targets]]