LF Fortran 95

Sampler Tool

Tuning a program can significantly reduce its execution time. A specific ion of a program may take most of the processing time, so tuning that section may greatly speed up the processing of the program. The Sampler tool helps you tune programs and detect bottlenecks.

Remarks:

When you tune a program, start by checking the cost for each function. If cost of a function is high, the following two factors may be causes:

For the first cause, check the cost of the function source. For the second cause, check the source cost of the function calling this function.

The cost described in this chapter is the summed result of execution locations extracted per a specific time unit (per second, for example) based on a given sampling frequency. To illustrate, the cost of function f in a program is the number of locations belonging to f from the locations extracted per a specific time value.

Starting and Terminating the Sampler

Starting the Sampler

When the Sampler is started, the last used sample data file name and the executable file name is restored.

There are two ways to start the sampler:

  1. From the Windows desktop icon
  2. From the Windows command prompt

Starting from the Sampler icon

Start the sampler by double-clicking the Sampler icon on your Windows desktop if you chose to have an icon at installation time; otherwise start it from the Start|Programs menu.

Starting from the Command prompt

Type

SAMP

followed by the <Enter> key.

Terminating the Sampler

To terminate the sampler, choose the Exit Sampler command from the File menu in the sampler window.

The Sampler Window

See the figure below for the sampler window.

The above figure illustrates the following items:

Sampler Menus

The sampler menus are outlined below.

File Menu

The table below lists the File menu commands.

Commands for the File Menu

Command

Function

Select Files

Open dialog for selecting executable (.exe) file and specifying sampling data output (.smp) file.

Print

Print the displayed tuning information

Print Preview

Display pages as they would appear if printed

Print Setup

Configure the printer

Exit Sampler

Terminate the Sampler

Remarks:

When the "OK" button in the "Select Files" dialogbox is clicked, the "Executable File and Sample Data File" window appears.

The "Print" and "Print Preview" commands are displayed only if tuning information is being displayed.

The "Print" and "Print Preview" commands cannot be used for the function calling relationship diagram.

Sampler Menu

The table below lists the Sampler menu commands.

Commands in the Sampler Menu

Command

Function

Execute

Run the program to collect tuning information

Executing Options

Specify command line arguments and runtime options to the program and execute the program to collect tuning information

Function Cost

Display the cost for each function

Source Cost

Display the cost for each program unit

Calling Tree

Display the function calling relationship diagram (calling tree)

Program Type: Fortran

Specify whether to display Fortran program

information for the Sampler Data

Program Type: C

Specify whether to display C program

information for the Sampler Data

Program Type: Other

Specify whether to display information other than C or Fortran program information for the Sampler Data.

Source File Directory

Specify the source file directory

View Menu

The table below lists the View menu commands.

Commands in the View Menu

Command

Function

Status Bar

Specify whether to display the status bar.

Toolbar

Specify whether to display the toolbar.

File Information

Specify whether to display file information

Window Menu

The table below lists the Window menu commands.

Commands in the Window Menu

Command

Function

Cascade

Display all open windows so that they overlap, revealing the Title bar for each window.

Tile Horizontally

Display the listed tuning information from left to right.

Tile Vertically

Display the listed tuning information from top to bottom.

Arrange Icons

Arrange all the icons along the bottom of the window.

Close All

Close all open windows

Note: the Window menu is displayed only if tuning information is being displayed.

Help Menu

The table below lists the Help menu commands.

Commands in the Help Menu

Command

Function

Help Topics

Display the Sampler help topics

About Sampler

Display version information for the Sampler.

Using the Sampler

The functions of the sampler are listed below. This section explains how to use these functions.

Collecting Tuning Information

In order to generate tuning information, the program must be compiled with the -trace option (see -[N]TRACE). To collect tuning information, run the program once, following the steps outlined below:

  1. In the Sampler, select the "Select Files..." command from the File menu. The Select Files dialog box appears.
  2. Specify the Sample Data File that the Sampler will use for output, either by typing it in or browsing. The file must have an extension of .smp. Note that selection through browsing will set the default directory.
  3. Specify the Executable File, either by typing it in or browsing. The file must have an extension of .exe.
  4. Select one of the following methods of running the program:

Displaying Tuning Information

The sampler displays the following three items of tuning information.

Recompilation is not required for an object generated with the Fujitsu Fortran compiler. To use the C compiler, specify the /Kline option at compilation.

The method of displaying each item of information is listed below.

Displaying the Cost for Each Function

Do the following to display the cost for each program unit:

In the sampler window, select the Function command from the Display menu. The function cost window appears. (See the figure below.)

Displaying the Cost Per Line

Do the following to display the cost per line of the source level:

The following procedures can also be used to display the cost per line of the source level:

Double clicking the function name that corresponds to the source code in the function cost window also shows the cost per line of the source code level.

The Calling Relationship Diagram

Do the following to display the function calling relationship diagram.

Click the left button in the box of file names in the calling tree window to display the Focus and Detail menus. Select the Focus menu to display the calling relationship diagram from the function; select the Detail menu to display detailed information. If the Focus Level is more than 1, press the left button outside the box to display the Top Level and Previous Level menus. Select the Top Level menu to display the relationship diagram of jump level 1. Select the Previous Level menu to display the previous relationship diagram.

Note: The cost information per line of the source level may differ slightly from the actual cost, because it is affected by the measuring machine status when information is collected (such as machine load status, number of logging users, and number of demons). The cost for each function always has about the same rate for the same program.