Analyzing Program Performance With Sun WorkShop

Using LoopTool

The main window displays the runtimes of your program's loops in a bar chart arranged in the order that the source files were presented to the compiler.

Figure 3-1 shows the components of the LoopTool window.

Figure 3-1 LoopTool Main Window

Graphic

Opening Files

To open executable and timing files, choose File Open in the main window.

There are two ways to specify the files you want to open:

  1. Type in the name of the files to open.

  2. Bring up a file chooser.

Once you enter the executable's path, you don't need to type in the timing file, unless it's in a different directory or has a non-default name (or both).

For more information about opening files, see the Analyzing the Loops in Your Program section of the Sun WorkShop Online Help.

Creating a Report on All Loops

To open a window with detailed information on all the loops in your program, choose File Create Report in the main window (see Figure 3-2). The generated report is identical to that produced by LoopReport.

The Help button in the report window links to the Sun WorkShop online help section containing compiler hints.

Figure 3-2 LoopReport

Graphic

Printing the LoopTool Graph

To print the LoopTool graph, choose File Print Graph in the main window and type the name of your chosen printer. To save the graph to a file, type a filename instead of a printer name.

For more information about printing see the Sun WorkShop online help.

Choosing an Editor

Choose File Options in the main window to open the Options dialog box, where you can choose an editor for editing source code. The available editors are vi, gnuemacs, and xemacs.


Note -

vi and xemacs are installed with LoopTool into your install directory (usually /opt/SUNWspro/bin) if they're not already on your system. You must provide gnuemacs yourself. In all cases, the editor you want must be in a directory in your search path in order for LoopTool to find it. For example, your PATH environment variable should include /usr/local if that's where gnuemacs is located on your system.


For more information about choosing an editor see the WorkShop Online Help.

Getting Hints and Editing Source Code

Clicking a loop in the main window (see Figure 3-1) does two things:

Figure 3-3 shows an xemacs editor window with a loop selected, and a hint window with an explanation of a compiler hint.

Figure 3-3 The Text Editor and Hints Windows

Graphic


Caution - Caution -

If you edit your source code, line numbers shown by LoopTool may become inconsistent with the source. You must save and recompile the edited source and then run LoopTool with the new executable, producing new loop information, for the line numbers to remain consistent.