The IDL Workbench > Profiler View

# The IDL Code Profiler

The IDL Code Profiler helps you analyze the performance of your applications. You can easily monitor the calling frequency and execution time for procedures and functions.

Note: If the tab for the Profiler View is not visible, simply choose WINDOW > Profiler. It is also available by choosing WINDOW > Show View > Other from the main IDL-DE menu bar across the top of the screen. A popup will appear allowing you to choose "Profiler View."

## Running the Profiler from the Workbench

To use the Profiler from the Workbench, follow the steps below:

1. Make sure that all of your code is compiled, either by running your application once, or by using the Compile button.
2. Click on the "Profiler" tab.
3. Click the "Enable Profiler" button (see screenshot, above).
4. Once the Profiler is enabled, run your code, either by selecting "Run" if your program is open in the Editor, or by typing the commands in the IDL Console.
5. When the program completes, go back to the Profiler tab and click the same button as the one used to enable the profiler. This will stop the profiler.

After the profiler stops, you will see the results appear in the Profiler (see below). The profiler displays the values for different times taken during each of the routines and statements used in the IDL code you are testing.

## Running the Profiler from the IDL Console

You can also run the profiler using the TIC and TOC commands. The results will automatically appear in the Profiler view. Follow these steps:

1. Make sure that all of your code is compiled, either by running your application once, or by using the Compile button.
2. Execute the following code in the IDL Console:
   `IDL> TIC, /PROFILER`
   `IDL> MY_APPLICATION`
   `IDL> TOC`
3. The Profiler View will automatically be populated with the results. Click on the "Profiler" tab to see the results.

Note: Clicking on a header name will sort the results.

## The Profiler View

The Profiler View contains nine columns:

- Routine - the name of the IDL routine. System routines (in C code) are shown in italics.
- Hit count - the number of times that the routine was called.
- Time self - The time spent only within the routine, not including any subroutines or other system routines.
- Time/hit - The time spent only within the routine, divided by the number of hits.
- Time+sub - The time spent within the routine plus all subroutines and system routines.
- Time+sub/hit - The time spent within the routine and subroutines, divided by the number of hits.
- Lines Run - The number of code lines that were executed within the routine. This is empty for system routines.
- Total Lines - The total number of code lines within the routine. This is empty for system routines.
- Code Coverage - The fraction of the total lines of code that were executed, which is just the ratio of Lines Run to Total Lines. A value of 0% indicates that none of the code was executed, while 100% indicates that all of the code was executed.

Tip: Clicking on one of the column headers will sort the results based upon that column. Clicking again will sort in the reverse order.

## Code Coverage

The Profiler View is integrated with the Editor. If you double click on an IDL `.pro` routine, the Editor will be opened to that routine. If code coverage is not already displayed, you can turn on "Show Code Coverage" using either the button on the Profiler View's toolbar or the Run->Show Code Coverage menu item.

See Code Coverage for details.

## See Also

Class Hierarchy, Code Coverage, Command History, Console View, PROFILER, Preferences, Editor View, Menubar and Toolbar, Outline View, Problems View, Project Explorer, Workbench Overview, Variables View