LabVIEW™ Performance and Memory Management
This application note describes the Performance Profiler, a feature that shows you data about execution time of your VIs and monitors single-threaded, multithreaded, and multiprocessor applications. This note also describes factors affecting run-time speed and memory usage.
VI Performance Profiling
The VIPerformance Profiler is a powerful tool for determining where your application is spending its time and how it is using memory. The Profile window has an interactive tabular display of time and memory usage for each VI in your system. Each row of the table contains information for a specific VI. The time spent by each VI is divided into several categories and summarized. The Profile window calculatesthe minimum, maximum, and average time spent per run of a VI. You can use the interactive tabular display to view all or part of this information, sort it by different categories, and look at the performance data of subVIs when called from a specific VI. Select Tools»Advanced»Profile VIs to access the Profile window. The following illustration shows an example of the window already in use.LabVIEW™, ni.com™, and National Instruments™ are trademarks of National Instruments Corporation. Product and company names mentioned herein are trademarks or trade names of their respective companies.
© Copyright 2000 National Instruments Corporation. All rights reserved.
The collection of memory usage information is optional because the collection process can add asignificant amount of overhead to the running time of your VIs. You must choose whether to collect this data before starting the Profiler by checking the Profile Memory Usage checkbox appropriately. This checkbox cannot be changed once a profiling session is in progress. The following buttons are available on the Profile window: • • • Start – Enables the collection of performance data. It is best tostart a profiling session while your application is not running to ensure that you measure only complete runs of VIs, and not partial runs. Snapshot – Views the data currently available. This gathers data from all the VIs in memory and displays it in the tabular display. Save – Saves the currently displayed data to disk as a tab-delimited text spreadsheet file. This data can then be viewed in aspreadsheet program or by VIs.
Viewing the Results
You can choose to display only parts of the information in the table. Some basic data is always visible, but you can choose to display the statistics, details, and (if enabled) memory usage by checking or unchecking the appropriate checkboxes in the Profile window. Performance information also is displayed for Global VIs. However, thisinformation sometimes requires a slightly different interpretation, as described in the category-specific sections below. You can view performance data for subVIs by double-clicking the name of the subVI in the tabular display. When you do this, new rows appear directly below the name of the VI and contain performance data for each of its subVIs. When you double-click the name of a Global VI, new rowsappear for each of the individual controls on its front panel. You can sort the rows of data in the tabular display by clicking in the desired column header. The current sort column is indicated by a bold header title. Timings of VIs do not necessarily correspond to the amount of elapsed time that it takes for a VI to complete. This is because a multithreaded execution system can interleave theexecution of two or more VIs. Also, there is a certain amount of overhead not attributed to any VI, such as the amount of time taken by a user to respond to a dialog box, or time spent in a Wait function on a block diagram, or time spent to check for mouse clicks. The basic information that is always visible in the first three columns of the performance data consists of the following items: • VI Time...