Sun Studio 12 Update 1: Performance Analyzer

Index Lines in the Source Tab

A source file is any file compiled to produce an object file or interpreted into byte code. An object file normally contains one or more regions of executable code corresponding to functions, subroutines, or methods in the source code. The Analyzer analyzes the object file, identifies each executable region as a function, and attempts to map the functions it finds in the object code to the functions, routines, subroutines, or methods in the source file associated with the object code. When the analyzer succeeds, it adds an index line in the annotated source file in the location corresponding to the first instruction in the function found in the object code.

The annotated source shows an index line for every function, including inline functions, even though inline functions are not displayed in the list displayed by the Function tab. The Source tab displays index lines in red italics with text in angle-brackets. The simplest type of index line corresponds to the function’s default context. The default source context for any function is defined as the source file to which the first instruction in that function is attributed. The following example shows an index line for a C function icputime.


                    578. int
                    579. icputime(int k)
0.       0.         580. {
                         <Function: icputime>

As can be seen from the above example, the index line appears on the line following the first instruction. For C source, the first instruction corresponds to the opening brace at the start of the function body. In Fortran source, the index line for each subroutine follows the line containing the subroutine keyword. Also, a main function index line follows the first Fortran source instruction executed when the application starts, as shown in the following example:


   	                           	 1. ! Copyright 02/27/09 Sun Microsystems, Inc. All Rights Reserved
     	     	     	     	   2. ! @(#)omptest.f 1.10 09/02/27 SMI
     	     	     	     	   3. ! Synthetic f90 program, used for testing openmp directives and the
     	     	     	     	   4. !       analyzer
     	     	     	     	   5. 
0.   	0.   	0.   	0.   	   6.         program omptest
                                          <Function: MAIN>  
                                       7.
                                       8. !$PRAGMA C (gethrtime, gethrvtime)    	     	     	     	      

Sometimes, the Analyzer might not be able to map a function it finds in the object code with any programming instructions in the source file associated with that object code; for example, code may be #included or inlined from another file, such as a header file.

Also displayed in red are special index lines and other special lines that are not compiler commentary. For example, as a result of compiler optimization, a special index line might be created for a function in the object code that does not correspond to code written in any source file. For details, refer to Special Lines in the Source, Disassembly and PCs Tabs.