Profiling VI Execution Time and Memory Usage

The Profile Performance and Memory window is a powerful tool for analyzing how your application uses execution time and memory. With this information, you can identify the specific VIs or parts of VIs you need to optimize. For example, if you notice that a particular subVI takes a long time to execute, you can focus your attention on improving the performance of that VI.

Complete the following steps to profile a VI.

  1. Stop all running VIs. If you do not stop these VIs, the results that the Profile Performance and Memory window displays can be misleading or inconsistent.
  2. Select Tools»Profile»Performance and Memory to display the Profile Performance and Memory window.
  3. If you want to collect memory usage information, place a checkmark in the Profile memory usage checkbox. You cannot place a checkmark in this checkbox after starting the profiling session. Collecting information about VI memory use adds a significant amount of overhead to VI execution, which affects the accuracy of any timing statistics you gather during the profiling session. Therefore, you should perform memory profiling separate from time profiling.
  4. Click the Start button in the Profile Performance and Memory window to begin the collection of performance data.
  5. Run the VI you want to profile.
  6. Run the VI to completion, or click the front panel stop button to stop the VI if it is running continuously. If there is no stop button, click the Abort Execution button.
  7. Click the Stop button in the Profile Performance and Memory window to end the profiling session. The tabular display includes the time it took the top-level VI to run, the time it took all subVIs to run, and the total time it took the VI and all subVIs to run within this profiling session.
Note  The Profile Performance and Memory window measures only CPU usage time. During wait functions, the CPU is free to process other tasks in the operating system, but the Profile Performance and Memory window still measures the small amount of time the CPU takes to initiate and return from the wait. The Profile Performance and Memory window does not measure the CPU usage time for calling by reference or for using control references in Property Nodes separately from the CPU usage time for other nodes.
  1. If you place a checkmark in the Timing statistics checkbox, the tabular display includes more statistics about the VI run times. If you place a checkmark in the Timing details checkbox, the tabular display includes several timing categories that can help you determine what operations take the most time. If you place a checkmark in the Memory usage checkbox, which is only available if you place a checkmark in the Profile memory usage checkbox before you begin the profiling session, you can view information about how your VIs are using memory.

In addition to the Profile Performance and Memory window, the LabVIEW VI Analyzer Toolkit provides tests that check VIs interactively or programmatically for performance, efficiency, and other aspects of LabVIEW programming.

You also can use the LabVIEW Desktop Execution Trace Toolkit to monitor code analysis, memory leaks, and other aspects of LabVIEW programming.