Improve Run-Time Performance with NI LabWindows™/CVI Execution Profiler Toolkit

Overview

The LabWindows/CVI Execution Profiler Toolkit is a performance measurement tool that acquires execution data from LabWindows/CVI applications and provides a graphical representation of the time in a viewer. You can use the profiled data to debug and optimize the execution speed of your LabWindows/CVI applications.

Contents

Introduction

The C programming language provides low-level control so developers can optimize the run-time performance of applications. C developers often spend a large amount of time analyzing source code to evaluate the execution speed and making changes to attempt to fully optimize applications for better performance. LabWindows/CVI 2009 introduces the LabWindows/CVI Execution Profiler Toolkit to help increase productivity and speed up analysis and optimization of the run-time performance of LabWindows/CVI applications.

Using the LabWindows/CVI Execution Profiler Toolkit

Enabling Execution Profiling

You can enable profiling in LabWindows/CVI through the Build Options dialog box in LabWindows/CVI and use the CVIProfSetCurrentThreadProfiling function in the Utility Library. When running an application that has been configured for profiling, LabWindows/CVI creates a .cvip file containing profile information that you can then view as flattened, threaded, or call tree form in the Profile Viewer. To enable profiling, use the CVIProfSetCurrentThreadProfiling function to set profiling on each thread in your application and select one of the following options from the Profiling option of the Build Options dialog box:

  • User functions - Profiles only user-defined functions. These are functions that you define in source files.
  • User functions and other calls - Profiles user-defined functions and calls to all other functions. For example, calls to other functions might include calls to LabWindows/CVI functions, Win32 API functions, and so on. These other calls are dimmed in the Profile Viewer.

LabWindows/CVI creates a .cvip file at run time, which contains profiling information you can then analyze in the Profile Viewer.

Loading an Execution Profile

You can choose from three options to view the execution profile information that was created at run time:

  • Automatically launch the Profile Viewer with the .cvip file loaded by enabling the Launch Viewer after profiling the option in the Profiler Settings dialog box. You can launch the Profiler Settings dialog box by selecting Options»Profiler Settings in the Profile Viewer.
  • Open the .cvip file you want to analyze by selecting File»Open in the Profile Viewer.
  • Drag and drop the .cvip file into the Profile Viewer.


Analyzing an Execution Profile

After loading the .cvip file in the Profile Viewer, you can select from three views:

  • Flattened - This view displays the timing information of all profiled functions in the program. Use the Flattened View to quickly determine which functions took the most time to execute.
  • Threaded - This view displays the timing information of profiled functions arranged by the calling threads. Use the Threaded View to find out which functions took the most time to execute per thread. The Threaded View tab does not appear in the Profile Viewer for single-threaded applications. The root-level functions in the Threaded View correspond to entry-point functions in each thread. If a root-level function calls any other functions, those other functions appear indented and below the root-level function, in a flattened list regardless of the code path of the thread.
    Note: The Threaded View is available in multithreaded applications only.
  • Call Tree - This view displays the timing information based on profiled call branches. Use the Call Tree View to investigate the execution of specific code paths. When you select a function in this view, the Profile Viewer displays bar plot information on a component basis. A component consists of the profiled times of a parent function and its immediate child functions. If a function is both a parent and a child, the bar plot associates the function with the component that includes its own child functions, rather than the component that includes its parent function.

Additional Resources

The LabWindows/CVI Execution Profiler Toolkit is now included in both the Base and Full editions of LabVIEW/CVI.

Participate in the LabWindows/CVI Community
Post, share, learn, and connect with LabWindows/CVI users around the world by joining the online user group.

 

The mark LabWindows is used under a license from Microsoft Corporation. Windows is a registered trademark of Microsoft Corporation in the United States and other countries.