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.
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:
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.
Type
SAMPfollowed by the <Enter> key.
To terminate the sampler, choose the Exit Sampler command from the File menu in the sampler window.
See the figure below for the sampler window.
The above figure illustrates the following items:
The sampler menus are outlined below.
The table below lists the File menu commands.
|
Command |
Function |
|---|---|
|
Select Files |
Open dialog for selecting executable (.exe) file and specifying sampling data output (.smp) file. |
|
|
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 |
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.
The table below lists the Sampler menu commands.
|
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 |
The table below lists the View menu commands.
|
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 |
The table below lists the Window menu commands.
|
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.
The table below lists the Help menu commands.
|
Command |
Function |
|---|---|
|
Help Topics |
Display the Sampler help topics |
|
About Sampler |
Display version information for the Sampler. |
The functions of the sampler are listed below. This section explains how to use these functions.
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:
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.
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.)
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.
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.