hexagon gprof profiler · hexagon graphical profiler user guide, hexagon simulator user guide...

62
Hexagon gprof Profiler A GNU Manual 80-N2040-4 Rev. C August 26, 2011 Submit technical questions to: https://www.codeaurora.org QUALCOMM is a registered trademark of QUALCOMM Incorporated in the United States and may be registered in other countries. Hexagon is a trademark of QUALCOMM Incorporated in the United States and other countries. Other product and brand names may be trademarks or registered trademarks of their respective owners. Authors Jay Fenlason, Richard Stallman, QUALCOMM Incorporated, Qualcomm Innovation Center, Inc. Portions copyrighted by Free Software Foundation, Inc., QUALCOMM Incorporated, Qualcomm Innovation Center, Inc., and Code Aurora Forum. Published by Code Aurora Forum 48377 Fremont Blvd., Ste. 117 Fremont, CA 94538 U.S.A.

Upload: others

Post on 21-Jul-2020

110 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

Hexagon gprof ProfilerA GNU Manual

80-N2040-4 Rev. C

August 26, 2011

Submit technical questions to:https://www.codeaurora.org

QUALCOMM is a registered trademark of QUALCOMM Incorporated in the United States and may be registered in other countries. Hexagon is a trademark of QUALCOMM Incorporated in the United States and other countries. Other product and brand names may be trademarks or registered trademarks of their respective owners.

Authors Jay Fenlason, Richard Stallman, QUALCOMM Incorporated, Qualcomm Innovation Center, Inc.

Portions copyrighted by Free Software Foundation, Inc., QUALCOMM Incorporated, Qualcomm Innovation Center, Inc., and Code Aurora Forum.

Published byCode Aurora Forum

48377 Fremont Blvd., Ste. 117 Fremont, CA 94538

U.S.A.

Page 2: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 2 CODE AURORA FORUM

Chapters 1, 5, and 8 are licensed under the following terms:Copyright © 2008-2010 QUALCOMM Incorporated.Copyright © 2010 Qualcomm Innovation Center, Inc.Copyright © 2010-2011 Code Aurora Forum.Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with the Invariant Sections being “Free Software” and “Free Software Needs Free Documentation”, with the Front-Cover Texts being “A GNU Manual,” and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled “GNU Free Documentation License.”(a) The Free Software Foundation’s Back-Cover Text is: “You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.”All product names mentioned herein are the trademarks of their respective owners.

Chapters 2-4, 6-7 are a Qualcomm-modified version of the document entitled GNU gprof, the GNU Profiler and are licensed under the following terms:

Copyright © 1988, 1992, 1997, 1998 Free Software Foundation, Inc.Copyright © 2008-2010 QUALCOMM Incorporated.Copyright © 2010 Qualcomm Innovation Center, Inc.Copyright © 2010-2011 Code Aurora Forum.Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.Permission is granted to copy and distribute translations of this manual into another language, under the same conditions as for modified versions.

Page 3: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 3 CODE AURORA FORUM

Contents

1 Introduction........................................................................................... 51.1 Overview ...................................................................................................................... 51.2 Profiling........................................................................................................................ 61.3 Using the document...................................................................................................... 61.4 Notation ........................................................................................................................ 71.5 System requirements .................................................................................................... 71.6 Feedback....................................................................................................................... 7

2 Using the Profiler.................................................................................. 82.1 Overview ...................................................................................................................... 82.2 Starting the profiler....................................................................................................... 92.3 Profiler options ........................................................................................................... 11

2.3.1 Output options................................................................................................... 122.3.2 Analysis options................................................................................................ 142.3.3 Miscellaneous options....................................................................................... 15

2.4 Generating profiler information ................................................................................. 162.5 Profile data formats .................................................................................................... 172.6 Symspecs .................................................................................................................... 17

3 Profiler Data ........................................................................................ 193.1 Overview .................................................................................................................... 193.2 Flat profile .................................................................................................................. 203.3 Call graph ................................................................................................................... 21

3.3.1 Primary line....................................................................................................... 223.3.2 Lines for a function’s callers............................................................................. 233.3.3 Lines for a function’s subroutines..................................................................... 243.3.4 Mutually recursive functions ............................................................................ 25

3.4 Line-by-line profiling ................................................................................................. 293.5 Annotated source listing ............................................................................................. 31

4 Accuracy of Profiler Data................................................................... 334.1 Overview .................................................................................................................... 334.2 Profile time units ........................................................................................................ 334.3 Call graph estimates ................................................................................................... 33

Page 4: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 4 CODE AURORA FORUM

Hexagon gprof Profiler Contents

5 Profiler Data Utilities .......................................................................... 345.1 Overview .................................................................................................................... 345.2 gmon file dumper ....................................................................................................... 35

5.2.1 Starting the gmon file dumper .......................................................................... 355.2.2 Command options ............................................................................................. 355.2.3 Input file............................................................................................................ 355.2.4 Output file ......................................................................................................... 36

5.2.4.1 Header ..................................................................................................... 365.2.4.2 Histogram records ................................................................................... 365.2.4.3 Call-graph records ................................................................................... 375.2.4.4 Basic-block records ................................................................................. 38

5.3 gmon file merger ........................................................................................................ 395.3.1 Starting the gmon file merger ........................................................................... 395.3.2 Command options ............................................................................................. 395.3.3 Input files .......................................................................................................... 395.3.4 Output file ......................................................................................................... 39

6 Frequently Asked Questions............................................................. 406.1 Overview .................................................................................................................... 40

7 Incompatibilities with UNIX gprof ..................................................... 417.1 Overview .................................................................................................................... 41

8 Processor-Specific Features ............................................................. 428.1 Overview .................................................................................................................... 42

A Acknowledgments ............................................................................. 43A.1 Overview ................................................................................................................... 43A.2 Profiler ....................................................................................................................... 43

B License Statements ........................................................................... 44B.1 History ....................................................................................................................... 44B.2 Free software.............................................................................................................. 45B.3 Free software needs free documentation ................................................................... 45B.4 GNU GENERAL PUBLIC LICENSE ...................................................................... 47

B.4.1 Preamble........................................................................................................... 47B.4.2 How to apply these terms to your new programs............................................. 52

B.5 GNU FREE DOCUMENTATION LICENSE ........................................................... 53B.5.1 ADDENDUM: How to use this license for your documents ........................... 59

Page 5: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 5 CODE AURORA FORUM

1 Introduction

1.1 OverviewThe gprof profiler is a software tool which displays information on the execution history of programs developed for the Qualcomm® Hexagon™ processor.

The profiler operates as a stand-alone text-based application. It is based on the GNU gprof profiler. For more information see www.gnu.org.

The profiler can display the following information:

■ Function-level profiling (time spent executing each function)

■ Line-level profiling (time spent executing each line of source code)

■ Call graph profiling (function execution times, caller/callee relationships)

The profiler works with all applications developed for the Hexagon processor (including stand-alone, RTOS-based, and single- or multi-threaded).

The profiler performs post-mortem profiling of the target application: it is used after the target application has completed execution. The simulator generates one or more data files containing profiling information while it executes the target application. After the simulation completes, the profiler uses the generated profile data files to display the profiling information.

NOTE Other tools exist for profiling programs on the Hexagon processor: the graphical profiler, region profiler, and code coverage profiler. Some of these tools provide more profiling information than the others. For details see the Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide.The gprof profiler does not support profiling of dynamically-loaded objects. To profile programs that use dynamic loading, use the graphical profiler.

Page 6: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 6 CODE AURORA FORUM

Hexagon gprof Profiler Introduction

1.2 ProfilingProfiling enables you to learn where a program spends its execution time, and which functions called which other functions while the program was executing. This information can indicate which parts of the program code are slower than expected, and therefore which parts might be worth rewriting to make the program run faster. It can also reveal which functions are being called more or less often than expected. This can help you spot program bugs which otherwise might go unnoticed.

The profiler uses data collected during the actual execution of your program, so it can be used on programs that are too large or too complex to analyze by reading the source. Note, however, that the profiler data itself can be affected by how your program is run: if you don’t exercise a specific feature in the program while it is being profiled, no profile data will be generated for that feature.

1.3 Using the documentThis document is intended to serve as a reference for experienced C programmers with assembly language experience. It contains the following chapters:

■ Chapter 1, Introduction, presents an overview of the profiler and the document.

■ Chapter 2, Using the Profiler, describes the profiler commands and features that are used to profile a program.

■ Chapter 3, Profiler Data, describes the types of data collected by the profiler.

■ Chapter 4, Accuracy of Profiler Data, describes issues that affect the accuracy of profiler data.

■ Chapter 5, Profiler Data Utilities, describes two utility programs which are provided for manipulating profiler data.

■ Chapter 6, Frequently Asked Questions, presents some frequently-asked questions about the profiler.

■ Chapter 7, Incompatibilities with UNIX gprof, describes incompatibilities between the GNU and Berkeley UNIX versions of the profiler.

■ Chapter 8, Processor-Specific Features, describes the features that were added to support the Hexagon processor.

■ Appendix A, Acknowledgments, lists the people who have contributed to the development of the profiler.

■ Appendix B, License Statements, lists the license statements for this document.

Page 7: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 7 CODE AURORA FORUM

Hexagon gprof Profiler Introduction

1.4 NotationThis document uses italics for terms and document names:

executable object file

Hexagon V2 Programmer’s Reference Manual

Courier font is used for computer text:

.Ltext0: .section .rodata .p2align 3 .string "hello, world\n"

The following notation is used to define command syntax:

■ Square brackets enclose optional items (e.g., [label]).

■ Bold is used to indicate literal symbols (e.g., [comment]).

■ The vertical bar character | is used to indicate a choice of items.

■ Parentheses are used to enclose a choice of items (e.g., (add|del)).

■ An ellipsis, ..., follows items that can appear more than once.

1.5 System requirementsThe profiler runs on the Windows® and Linux® operating systems.

1.6 FeedbackIf you have any comments or suggestions on how to improve the profiler (or this document), please send them to:

https://support.cdmatech.com

Page 8: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 8 CODE AURORA FORUM

2 Using the Profiler

2.1 OverviewProfiling a program is a two-step procedure:

1. Execute the program with profiling enabled to generate a profile data file (Section 2.4)

2. Run the profiler to analyze the profile data (Section 2.2)

The profiler generates three types of profile information: flat profile, call graph, and annotated source.

The flat profile shows how much time your program spent in each function, and how many times that function was called (Section 3.2). If you simply want to know which functions consume most of the cycles, it is stated concisely here.

The call graph shows, for each function, which functions called it, which other functions it called, and how many times (Section 3.3). There is also an estimate of how much time was spent in the subroutines of each function. This can suggest places where you might try to eliminate function calls that use a lot of time.

The annotated source listing is a copy of the program’s source code, labeled with the number of times each line of the program was executed (Section 3.5).

Page 9: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 9 CODE AURORA FORUM

Hexagon gprof Profiler Using the Profiler

2.2 Starting the profilerOnce you have created a profile data file (Section 2.4), you can run the profiler to analyze the profile data.

To start the profiler from a command line, type:

hexagon-gprof option... [executable-files...] [profile-data-files...] [> outfile]

Executable files

The profiler accepts the executable file of the program to be profiled. If you do not specify the executable file on the command line, the profiler assumes it is named a.out.

The profiler uses the program symbols defined in this file to create the profile information.

NOTE The symbols for an RTOS application system are distributed across multiple executable files (i.e., one for the kernel and each RTOS application). In this case, each of these files must be specified on the command line.

Profile data files

The profiler accepts the profile data file of the program to be profiled. If you do not specify this file on the command line, the profiler assumes it is named gmon.out.

In some cases a program’s profile data is distributed across multiple profile data files:

■ When a program is a multithreaded stand-alone program, its profile data files are named for each hardware thread (i.e., gmon.t_0, gmon.t_1, ...).

■ When a program is a multithreaded RTOS application, its profile data files are named for each software thread (i.e., gmon.name1, gmon.name2, ...).

In these cases, each of the profile data files must be specified on the command line. The profiler will sum together the statistics in these files – for details see Section 2.5.

For more information on profile data files see the Hexagon Simulator User Guide.

Output file

The profiler prints the flat profile and call graph to the standard output. This is typically redirected to a file using the redirect symbol ‘>’.

NOTE If any file is not in the proper format, or if the profile data file does not appear to belong to the executable file, an error message is printed.

Page 10: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 10 CODE AURORA FORUM

Hexagon gprof Profiler Using the Profiler

Option files

Profiler command arguments can be specified in a text file rather than on the command line. The file is specified on the command line as the argument of the special command option @. For example:

hexagon-gprof @myoptions

Here the file named myoptions contains the command arguments for the hexagon-gprof command. The file contents are inserted into the command line in place of the specified @file option.

NOTE Command arguments stored in argument files must be delimited by whitespace characters.The @file option can appear in argument files – it is processed recursively.

Option help

To list the available command-line options, type:

hexagon-gprof -help

Page 11: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 11 CODE AURORA FORUM

Hexagon gprof Profiler Using the Profiler

2.3 Profiler optionsProfiler options are used to control various profiling features from the command line. They can be specified in any order.

Many options have alternate abbreviated switches defined for ease of use. These long and short forms – listed below as alternatives – are functionally equivalent.

The standard option names can also be truncated, as long as you specify enough of the option name to uniquely identify the option.

NOTE Option names can be prefixed with either “-” or “--”.

The options are specified by the command switches listed below.

-A[symspec] | --annotated-source[=symspec]-b | --brief-C[symspec] | --exec-counts[=symspec]--demangle --no-demangle --file-ordering map_file--function-ordering -i | --file-info-I dirs | --directory-path=dirs-J[symspec] | --no-annotated-source[=symspec]-L | --print-path-p[symspec] | --flat-profile[=symspec]-P[symspec] | --no-flat-profile[=symspec]-q[symspec] | --graph[=symspec]-Q[symspec] | --no-graph[=symspec]-T | --traditional-w width | --width=width-x | --all-lines-y | --separate-files-Z[symspec] | --no-exec-counts[=symspec]

-a | --no-static-c | --static-call-graph-D | --ignore-non-functions-k from/to -l | --line-m num | --min-count=num-n[symspec] | --time[=symspec]-N[symspec] | --no-time[=symspec]-z | --display-unused-functions

-Oname | --file-format=name-s | --sum-Sfilename | --external-symbols-table=filename-v | --version@filename

Page 12: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 12 CODE AURORA FORUM

Hexagon gprof Profiler Using the Profiler

2.3.1 Output optionsThese options specify the display format of the information generated by the profiler.

Many of these options take an optional symspec to specify functions to be included or excluded. These options can be specified multiple times, with different symspecs, to include or exclude sets of symbols. For details on symspecs see Section 2.6.

Specifying any of these options overrides the default (-p -q), which prints a flat profile and call graph analysis for all functions.

-A[symspec]--annotated-source[=symspec]

Print annotated source code. If symspec is specified, print output only for matching symbols. See Section 3.5.

-b--brief

Do not print the verbose blurbs that try to explain the meaning of all of the fields in the tables. This is useful if you intend to print out the output, or are tired of seeing the blurbs.

-C[symspec]--exec-counts[=symspec]

Print a tally of functions and the number of times each was called. If symspec is specified, print tally only for matching symbols. If the profile data file contains basic-block count records, specifying the -l option, along with -C, will cause basic-block execution counts to be tallied and displayed.

--demangle --no-demangle

Control whether C++ symbol names should be demangled when printing output. The default is to demangle symbols. The --no-demangle option can be used to turn off demangling.

--file-ordering map_file Print a suggested .o link line ordering for the program based on profiling data. This option suggests an ordering which may improve paging, TLB and cache behavior for the program on systems which do not support arbitrary ordering of functions in an executable. Use of the -a argument is highly recommended with this option. The map_file argument is a pathname to a file which provides function name to object file mappings. The format of the file is similar to the output of the archiver binary utility:

c-parse.o:00000000 T yyparsec-parse.o:00000004 C yyerrflagc-lang.o:00000000 T maybe_objc_method_namec-lang.o:00000000 T print_lang_statisticsc-lang.o:00000000 T recognize_objc_keywordc-decl.o:00000000 T print_lang_identifierc-decl.o:00000000 T print_lang_type...

The archiver can be used to create the map file specified by this option:

hexagon-nm --extern-only --defined-only -v --print-file-name

Page 13: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 13 CODE AURORA FORUM

Hexagon gprof Profiler Using the Profiler

--function-ordering

Print a suggested function ordering for the program based on profiling data. This option suggests an ordering which may improve paging, TLB and cache behavior for the program on systems which support arbitrary ordering of functions in an executable. The exact details of how to force the linker to place functions in a particular order is system dependent and out of the scope of this manual.

-i--file-info

Display summary information about the profile data file(s) and then exit. The number of histogram, call graph, and basic-block count records is displayed.

-I dirs --directory-path=dirs

Specify list of search directories in which to find source files. Environment variable GPROF_PATH can also be used to convey this information. Used mostly for annotated source output.

-J[symspec] --no-annotated-source[=symspec]

Do not print annotated source code. If symspec is specified, the profiler prints annotated source, but excludes matching symbols.

-L --print-path

Print the full pathname of source filenames, which is determined from symbolic debugging information in the image file, and is relative to the directory in which the compiler was invoked. Normally, source filenames are printed with the path component suppressed.

-p[symspec] --flat-profile[=symspec]

Print a flat profile. If symspec is specified, print flat profile only for matching symbols. See Section 3.2.

-P[symspec] --no-flat-profile[=symspec]

Suppress printing a flat profile. If symspec is specified, the profiler prints a flat profile, but excludes matching symbols.

-q[symspec] --graph[=symspec]

Print the call graph analysis. If symspec is specified, print call graph only for matching symbols and their children. See Section 3.3.

-Q[symspec] --no-graph[=symspec]

Suppress printing the call graph. If symspec is specified, the profiler prints a call graph, but excludes matching symbols.

-T --traditional

Print output in Berkeley Software Distribution (BSD) format.

Page 14: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 14 CODE AURORA FORUM

Hexagon gprof Profiler Using the Profiler

-w width --width=width

Set width of output lines to width. Currently only used when printing the function index at the bottom of the call graph.

-x --all-lines

Annotate every line in a basic-block by repeating the annotation for the first line. By default, only the lines at the beginning of a basic-block are annotated. This option affects annotated source output only.

-y --separate-files

Generate annotated source for a file named path/filename in the file filename-ann. Normally the profiler prints annotated source files to the standard output. This option affects annotated source output only.

-Z[symspec] --no-exec-counts[=symspec]

Do not print a tally of functions and the number of times each was called. If symspec is specified, print tally, but exclude matching symbols.

2.3.2 Analysis options-a--no-static

Suppress the printing of statically declared (private) functions. (These are functions whose names are not listed as global, and which are not visible outside the file/function/block where they were defined.) Time spent in these functions, calls to/from them, etc., will all be attributed to the function that was loaded directly before it in the executable file. This option affects both the flat profile and the call graph.

-c --static-call-graph

Augment the call graph of the program by a heuristic which examines the text space of the object file and identifies function calls in the binary machine code. Since normal call graph records are only generated when functions are entered, this option identifies children that could have been called, but never were. Calls to dynamic library routines are typically not found by this option. Parents or children identified via this heuristic are indicated in the call graph with call counts of 0.

-D --ignore-non-functions

Ignore symbols which are not known to be functions.

-k from/to Delete from the call graph any arcs from symbols matching symspec from to those matching symspec to.

Page 15: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 15 CODE AURORA FORUM

Hexagon gprof Profiler Using the Profiler

-l --line

Enable line-by-line profiling, which causes histogram hits to be charged to individual source code lines, instead of functions. If the program was compiled with basic-block counting enabled, this option will also identify how many times each line of code was executed. While line-by-line profiling can help isolate where in a large function a program is spending its time, it also significantly increases the running time of the profiler, and magnifies statistical inaccuracies. See Section 3.4.

-m num --min-count=num

Suppress symbols that are executed less than num times. This option affects execution count output only.

-n[symspec] --time[=symspec]

In call graph analysis, only propagate times for symbols matching symspec.

-N[symspec] --no-time[=symspec]

In call graph analysis, do not propagate times for symbols matching symspec.

-z --display-unused-functions

Mention all functions in the flat profile, even those that were never called, and that had no time spent in them. This is useful in conjunction with the -c option for discovering which routines were never called.

2.3.3 Miscellaneous options-Oname --file-format=name

Select format of the profile data files. Recognized formats are auto (the default), bsd, magic, and prof (not yet supported).

-s --sum

Summarize the information in the profile data files it read in, and write out a profile data file called gmon.sum which contains all the information from the profile data files that the profiler read in. The file gmon.sum may be one of the specified input files; the effect of this is to merge the data in the other input files into gmon.sum. Eventually you can run the profiler again without -s to analyze the cumulative data in the file gmon.sum.

-Sfilename--external-symbol-table=filename

Read symbol table from the specified symbol table file rather than from the specified executable file (Section 2.2). Useful for profiling kernel modules.

-v --version

Display current version number of the profiler.

Page 16: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 16 CODE AURORA FORUM

Hexagon gprof Profiler Using the Profiler

@filenameUse command arguments stored in the specified file (Section 2.2).

NOTE No space can appear between the at sign (@) and filename.

2.4 Generating profiler informationBefore you can analyze a program with the profiler, you must generate the data that the profiler uses to represent the program’s execution history.

To do this, run the program on the Hexagon processor simulator using the command option --profile.

Aside from using this option, be sure to run the program as usual, using the normal program arguments, file names, etc. The program should run normally, producing the same output as usual.

NOTE The program will run somewhat slower than normal because of the time spent by the simulator collecting and the writing the program’s profile data.

How you run a program – i.e., the arguments and inputs that you specify for it – can dramatically affect the profile information that is generated. The profile data will describe which parts of the program were activated for the particular input you use. For instance, if the first command your program receives is to quit, then the profile data will show the time used in initialization and in cleanup, but not much else.

The simulator writes the profile data to the current working directory in the form of one or more profile data files named gmon*:

■ If any files already exist in the directory with the same name as the generated profile data files, the existing files will be overwritten.

■ If you don’t have permission to write to the current working directory, the profile data files are not written, and an error message is displayed.

NOTE Currently there is no way to generate profile data files user-defined names. However, you can manually rename the files after they have been generated.

The simulator writes the profile data files when it exits after completing the simulation. Therefore, to write the gmon files the simulator must exit normally. Abnormal termination of either the simulator or the simulated program may result in invalid profile data.

NOTE For more information on using the simulator see the Hexagon Simulator User Guide.

Page 17: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 17 CODE AURORA FORUM

Hexagon gprof Profiler Using the Profiler

2.5 Profile data formatsBy default the simulator generates profile data files in a format which is specific to the Hexagon processor.

The processor-specific data format differs from the standard GNU format by enabling histogram “buckets” to contain values up to 264-1. The values are “pseudo-encoded” values of variable length.

NOTE This change removes the scaling inaccuracies that resulted from rounding values stored in the GNU-style profile data files.

The profiler will correctly scale and merge multiple profile data files with differing scale factors, bucket sizes, and histogram address ranges.

NOTE Care should be taken when processing multiple profile data files. The profiler allocates memory for the histogram buckets (i.e., 8 bytes per bucket) which may result in significant amounts of system memory getting used up.

The simulator stills supports the generation of profile data files in the standard GNU format. To do this, use the simulator command option --profile_old to generate the profile data files.

2.6 SymspecsTo control the amount of profile data generated by the profiler, several command-line options (Section 2.3.1) allow users to include or exclude certain functions from being profiled.

Functions are included or excluded from profiling by using symspecs (symbol specifications), which observe the following syntax:

filename_containing_a_dot| funcname_not_containing_a_dot| linenumber| ( [ any_filename ] ':' ( any_funcname | linenumber ) )

Here are some sample symspecs:

main.c

Selects everything in file main.c. The dot in the string tells the profiler to interpret the string as a filename, rather than as a function name. To select a file whose name does not contain a dot, a trailing colon should be specified. For example, odd: is interpreted as the file named odd.

main

Page 18: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 18 CODE AURORA FORUM

Hexagon gprof Profiler Using the Profiler

Selects all functions named main. Notice that there can be multiple instances of the same function name because some of the definitions may be local (i.e., static). Unless a function name is unique in a program, you must use the colon notation explained below to specify a function from a specific source file. Sometimes, function names contain dots. In such cases, it is necessary to add a leading colon to the name. For example, :.mul selects function .mul.

main.c:main

Selects function main in file main.c.

main.c:134

Selects line 134 in file main.c.

Page 19: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 19 CODE AURORA FORUM

3 Profiler Data

3.1 OverviewThe profiler can produce data in several different formats, the most important of which are described below. The simplest formats (file information, execution count, and function and file ordering) are not described here, but are documented with the respective options that trigger them. See Section 2.3.1.

NOTE The profiler displays all profile information in units of thread cycles instead of seconds. Cycle counts can be converted to seconds based on the clock frequency of the target Hexagon processor.For more information on cycle counts see the Hexagon Simulator User Guide.

Page 20: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 20 CODE AURORA FORUM

Hexagon gprof Profiler Profiler Data

3.2 Flat profileThe flat profile shows the number of thread cycles executed in each function in the program. For example:

Flat profile:

Each sample counts as 1 cycle(s) % cumulative self self total time cycle(s) cycle(s) calls c/call c/call name 15.30 3184 3184 82 38.83 55.83 qsisf 8.63 4979 1795 102 17.60 17.60 _Dscale 8.33 6713 1734 102 17.00 17.00 _FDscale 7.88 8353 1640 41 40.00 57.60 qsidf 6.54 9713 1360 20 68.00 111.60 qaddf3 5.06 10766 1053 81 13.00 13.00 FDunscale 4.68 11740 974 41 23.76 37.76 fixsfsi 4.53 12683 943 20 47.15 90.15 qaddsf3

...

The functions are sorted first by decreasing number of cycles spent in them, then by decreasing number of calls, and finally alphabetically by name.

NOTE Unless the -z option is specified, functions are not listed in the profile if cycles are not executed in them, and calls are not made to them.

Just before the column headers, a statement appears indicating the appropriate scaling factor for the cycle counts. Most of the time this factor will be 1; however, when it is not 1 the cycle counts should be multiplied by the given scale factor to obtain the actual cycle counts. Note that scaled cycle counts are subject to inaccuracy due to rounding.

The flat profile display includes the following fields:

% time

The percentage of the total number of cycles your program spent in this function. These should all add up to 100%.

cumulative cycle(s)

The cumulative total number of cycles spent executing this function, plus the cycles spent in all functions above this one in this table.

self cycle(s)

The number of cycles accounted for by this function alone. The flat profile listing is sorted first by this number.

calls

The total number of times that the function was called. If it was never called, or the number of times it was called cannot be determined, the calls field is blank.

self Mc/call

The average number of cycles spent in this function per call, if this function is profiled. Otherwise, this field is blank for this function. The first character determines the scale. For instance, “Mc” denotes millions of cycles, and “mc” denotes thousands of cycles.

Page 21: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 21 CODE AURORA FORUM

Hexagon gprof Profiler Profiler Data

total Mc/call

The average number of cycles spent in this function and its descendants per call, if this function is profiled. Otherwise, this field is blank for this function. This is the only field in the flat profile that uses call graph analysis.

name

The name of the function. The flat profile is sorted by this field alphabetically after the self cycles and calls fields are sorted.

3.3 Call graphThe call graph shows how much cycle time was spent in each function and its children. From this information, you can find functions that, while they themselves may not have used much cycle time, called other functions that did use unusual amounts of cycle time.

The following is a sample call graph from a small program. It was created from the same program execution as the flat profile example shown in Section 3.2.

granularity: each sample hit covers 4 byte(s) for 0.00% of 223675.00 cycle(s)

index % time self children called name <spontaneous>[1] 93.6 49.00 209219.00 get_cmd_str_ptr [1] 305.00 208914.00 1/1 __libc_start_main [2]----------------------------------------------- 305.00 208914.00 1/1 get_cmd_str_ptr [1][2] 93.5 305.00 208914.00 1 __libc_start_main [2] 683.00 207366.37 1/1 main [3] 66.00 633.63 1/1 exit [26] 98.00 0.00 1/1 atexit [41] 67.00 0.00 1/1 _init [44]----------------------------------------------- 683.00 207366.37 1/1 __libc_start_main [2][3] 93.0 683.00 207366.37 1 main [3] 164.00 181115.25 36/36 printf [5] 20740.00 0.00 36/36 countBits [12] 44.00 5030.98 1/1 fprintf [21] 164.00 108.13 36/36 __qdsp_modsi3 [36]----------------------------------------------- 541.68 4489.30 1/37 fprintf [21] 19500.32 161614.93 36/37 printf [5][4] 83.2 20042.00 166104.23 37 _Printf [4] 7075.31 89638.70 1008/1044 prout [6] 1820.00 51791.32 36/36 _Putfld [8] 8764.00 0.00 1083/1083 _Mbtowc [16] 1804.00 3454.07 36/36 _Puttxt [19] 868.00 0.00 36/36 strchr [24] 188.00 233.64 38/38 _Vacopy [33] 235.33 0.00 36/1080 memchr [18] 54.00 177.85 2/2 prout [37]----------------------------------------------- 164.00 181115.25 36/36 main [3][5] 81.0 164.00 181115.25 36 printf [5] 19500.32 161614.93 36/37 _Printf [4]-----------------------------------------------

Page 22: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 22 CODE AURORA FORUM

Hexagon gprof Profiler Profiler Data

The lines full of dashes divide the call graph table into entries, with one entry for each function, and one or more lines for each entry.

The primary line in each entry is the one that starts with an index number in square brackets: the end of this line indicates which function the entry is for.

The primary line in each entry can have additional lines before or after it:

■ The preceding lines describe the callers of the function

■ The following lines describe the function’s subroutines (or children, when speaking of the call graph).

The entries are sorted by the amount of time spent in the function and its subroutines.

NOTE Because of the way gprof computes cycle counts, the cycle data display sometimes includes fractions of a cycle.

3.3.1 Primary lineIn a call graph entry the primary line describes the function that the entry is about, and gives the overall statistics for this function.

In the following example, the primary line is repeated from the entry for function main in the main example (Section 3.3), along with the heading line showing the field names:

index % time self children called name...[3] 93.0 683.00 207366.37 1 main [3]

The primary line display includes the following fields:

index

Entries are numbered with consecutive integers. Each function therefore has an index number, which appears at the beginning of its primary line. Each cross-reference to a function, as a caller or subroutine of another, gives its index number as well as its name. The index number guides you if you want to look for the entry for that function.

% time

The percentage of the total number of cycles that was spent in this function, including time spent in subroutines called from this function. The cycle time spent in this function is counted again for the callers of this function. Therefore, adding up these percentages is meaningless.

self

The total number of cycles spent in this function. This should be identical to the number printed in the self cycle(s) field for this function in the flat profile.

children

The total number of cycles spent in the subroutine calls made by this function. This should be equal to the sum of all the self and children entries of the children listed directly below this function.

Page 23: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 23 CODE AURORA FORUM

Hexagon gprof Profiler Profiler Data

called

The number of times the function was called. If the function called itself recursively, there are two numbers, separated by a +. The first number counts non-recursive calls, and the second counts recursive calls. In the example above, the function main was called once from __libc_start_main.

name

The name of the current function. The index number is repeated after it. If the function is part of a cycle of recursion, the recursive-cycle number is printed between the function’s name and the index number (see Section 3.3.4). For example, if function gnurr is part of recursive-cycle number one, and has index number twelve, its primary line would be end like this:

gnurr <cycle 1> [12]

3.3.2 Lines for a function’s callersA function’s entry has a line for each function it was called by. These lines’ fields correspond to the fields of the primary line, but their meanings are different because of the difference in context.

In the following example, two lines are repeated from the entry for function main in the main example (Section 3.3) – the primary line and the single caller-line preceding it – along with the heading line showing the field names:

index % time self children called name... 683.00 207366.37 1/1 __libc_start_main [2][3] 93.0 683.00 207366.37 1 main [3]

The caller-line display includes the following fields:

self

An estimate of the amount of time spent in main itself when it was called from __libc_start_main.

children

An estimate of the amount of time spent in subroutines of main when main was called from __libc_start_main. The sum of the self and children fields is an estimate of the amount of time spent within calls to main from __libc_start_main.

called

Two numbers: the number of times main was called from __libc_start_main, followed by the total number of nonrecursive calls to main from all its callers.

name and index number

The name of the caller of main to which this line applies, followed by the caller’s index number. Not all functions have entries in the call graph; some options to the profiler request the omission of certain functions. When a caller has no entry of its own, it still has caller-lines in the entries of the functions it calls. If the caller is part of a recursion cycle, the cycle number is printed between the name and the index number.

Page 24: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 24 CODE AURORA FORUM

Hexagon gprof Profiler Profiler Data

NOTE If the identity of the callers of a function cannot be determined, a dummy caller-line is printed which has <spontaneous> as the “caller’s name” and all other fields blank. This can happen for signal handlers.

3.3.3 Lines for a function’s subroutinesA function’s entry has a line for each of its subroutines: in other words, a line for each other function that it called. These lines’ fields correspond to the fields of the primary line, but their meanings are different because of the difference in context.

In the following example, two lines are repeated from the entry for function main in the main example (Section 3.3) – the primary line and the single subroutine-line following it – along with the heading line showing the field names:

index % time self children called name...[3] 93.0 683.00 207366.37 1 main [3] 164.00 181115.25 36/36 printf [5]

The subroutine-line display includes the following fields:

self

An estimate of the number of cycles spent directly within printf when printf was called from main.

children

An estimate of the number of cycles spent in subroutines of printf when report was called from main. The sum of the self and children fields is an estimate of the total time spent in calls to printf from main.

called

Two numbers, the number of calls to printf from main followed by the total number of nonrecursive calls to printf. This ratio is used to determine how much of printf’s self and children time gets credited to main. See Section 4.3.

name

The name of the subroutine of main to which this line applies, followed by the subroutine’s index number. If the caller is part of a recursion cycle, the cycle number is printed between the name and the index number.

Page 25: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 25 CODE AURORA FORUM

Hexagon gprof Profiler Profiler Data

3.3.4 Mutually recursive functionsThe graph may be complicated by the presence of cycle or sequence of recursion in the call graph.

A recursive sequence exists if a function calls another function that directly or indirectly calls (or appears to call) the original function. For instance, if a calls b, and b calls a, then a and b form a recursive sequence.

Whenever call paths exist both ways between a pair of functions, they belong to the same sequence. If a and b call each other, and b and c call each other, then all three make one recursive sequence.

NOTE Even if b only calls a if it was not called from a, the profiler cannot determine this; therefore a and b are still considered a recursive sequence.

Recursive sequences are numbered with consecutive integers in profiler displays. When a function belongs to a recursive sequence, each time the function name appears in the call graph it is followed by <cycle number>.

NOTE In this case cycle refers to a sequence of recursion, and not to a processor cycle count.

The reason sequences of recursion matter is that they create paradoxes in the call graph cycle count values. The “cycle time spent in children” of a should include the cycle time spent in its subroutine b (and in b’s own subroutines); however, because of the recursive sequence one of b’s subroutines is a! This raises the question of how much of a’s cycle time should be included in the children of a, when a is indirectly recursive?

The way the profiler resolves this is by creating a single entry for the recursive-cycle as a whole:

■ The primary line of this entry describes the total cycle time spent directly in the functions of the recursive-cycle.

■ The “subroutines” of the recursive-cycle are the individual functions of the recursive-cycle, and all other functions that were called directly by them.

■ The “callers” of the recursive-cycle are the functions, outside the recursive-cycle, that called functions in the recursive-cycle.

Page 26: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 26 CODE AURORA FORUM

Hexagon gprof Profiler Profiler Data

The following example is a portion of a call graph which shows a recursive-cycle containing functions a and b. The recursive-cycle was entered by a call to a from main; both a and b called c.

----------------------------------------------- 20.00 16508.48 1/1 _start_main [2][3] 79.4 20.00 16508.48 1 main [3] 1604.00 6650.24 1/2 a <cycle 1> [7] 1604.00 6650.24 1/2 b <cycle 1> [5]-----------------------------------------------[4] 79.3 3208.00 13300.48 2+140 <cycle 1 as a whole> [4] 1510.00 7411.53 121 b <cycle 1> [5]----------------------------------------------- 120 a <cycle 1> [7] 1604.00 6650.24 1/2 main [3][5] 42.9 1510.00 7411.53 121 b <cycle 1> [5] 100.00 3636.82 20/41 c [6] 943.00 860.00 20/20 __qdsp_addsf3 [12] 776.59 340.00 20/82 __qdsp_floatsisf [9] 475.12 280.00 20/41 __qdsp_fixsfsi [16] 20 a <cycle 1> [7]-----------------------------------------------

The entire call graph for this program additionally contains an entry for main (which calls a) and an entry for c (with callers a and b):

index % time self children called name <spontaneous>[1] 82.6 52.00 17126.48 qdsp6_pre_main [1] 76.00 16692.48 1/1 _start_main [2] 358.00 0.00 2/2 memset [23]----------------------------------------------- 76.00 16692.48 1/1 qdsp6_pre_main [1][2] 80.6 76.00 16692.48 1 _start_main [2] 20.00 16508.48 1/1 main [3] 11.00 119.00 1/1 atexit [24] 16.00 11.00 1/1 exit [30] 7.00 0.00 1/1 _init [37]----------------------------------------------- 20.00 16508.48 1/1 _start_main [2][3] 79.4 20.00 16508.48 1 main [3] 1604.00 6650.24 1/2 a <cycle 1> [7] 1604.00 6650.24 1/2 b <cycle 1> [5]-----------------------------------------------[4] 79.3 3208.00 13300.48 2+140 <cycle 1 as a whole> [4] 1510.00 7411.53 121 b <cycle 1> [5]----------------------------------------------- 120 a <cycle 1> [7] 1604.00 6650.24 1/2 main [3][5] 42.9 1510.00 7411.53 121 b <cycle 1> [5] 100.00 3636.82 20/41 c [6] 943.00 860.00 20/20 __qdsp_addsf3 [12] 776.59 340.00 20/82 __qdsp_floatsisf [9] 475.12 280.00 20/41 __qdsp_fixsfsi [16] 20 a <cycle 1> [7]----------------------------------------------- 100.00 3636.82 20/41 b <cycle 1> [5] 105.00 3818.66 21/41 a <cycle 1> [7][6] 36.8 205.00 7455.48 41 c [6] 573.00 4593.48 41/41 drand48 [8] 1592.00 697.00 41/82 __qdsp_floatsisf [9]-----------------------------------------------

Page 27: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 27 CODE AURORA FORUM

Hexagon gprof Profiler Profiler Data

20 b <cycle 1> [5] 1604.00 6650.24 1/2 main [3][7] 36.5 1698.00 5888.95 21 a <cycle 1> [7] 105.00 3818.66 21/41 c [6] 815.41 357.00 21/82 __qdsp_floatsisf [9] 498.88 294.00 21/41 __qdsp_fixsfsi [16] 120 b <cycle 1> [5]----------------------------------------------- 573.00 4593.48 41/41 c [6][8] 24.8 573.00 4593.48 41 drand48 [8] 1640.00 721.52 41/41 __qdsp_floatsidf [10] 1360.00 871.96 20/20 __qdsp_adddf3 [11]----------------------------------------------- 776.59 340.00 20/82 b <cycle 1> [5] 815.41 357.00 21/82 a <cycle 1> [7] 1592.00 697.00 41/82 c [6][9] 22.0 3184.00 1394.00 82 __qdsp_floatsisf [9] 1394.00 0.00 82/102 _FDscale [14]----------------------------------------------- 1640.00 721.52 41/41 drand48 [8][10] 11.3 1640.00 721.52 41 __qdsp_floatsidf [10] 721.52 0.00 41/102 _Dscale [13]----------------------------------------------- 1360.00 871.96 20/20 drand48 [8][11] 10.7 1360.00 871.96 20 __qdsp_adddf3 [11] 520.00 0.00 40/40 _Dunscale [20] 351.96 0.00 20/102 _Dscale [13]----------------------------------------------- 943.00 860.00 20/20 b <cycle 1> [5][12] 8.7 943.00 860.00 20 __qdsp_addsf3 [12] 520.00 0.00 40/81 _FDunscale [18] 340.00 0.00 20/102 _FDscale [14]----------------------------------------------- 351.96 0.00 20/102 __qdsp_adddf3 [11] 721.52 0.00 41/102 __qdsp_floatsidf [10] 721.52 0.00 41/102 ldexp [15][13] 8.6 1795.00 0.00 102 _Dscale [13]----------------------------------------------- 340.00 0.00 20/102 __qdsp_addsf3 [12] 1394.00 0.00 82/102 __qdsp_floatsisf [9][14] 8.3 1734.00 0.00 102 _FDscale [14]-----------------------------------------------

The self field of the recursive sequences’s primary line indicates the total cycles spent in all the functions of the recursive sequence. It equals the sum of the self fields for the individual functions in the cycle, which is found in the entry in the subroutine lines for these functions.

The children fields of the recursive-cycle’s primary line and subroutine lines count only subroutines outside the recursive-cycle. Even though a calls b, the cycle count in those calls to b is not counted in a’s children cycle count. Thus, we do not encounter the problem of what to do when the time in those calls to b includes indirect recursive calls back to a.

The children field of a caller-line in the recursive-cycle’s entry estimates the number of cycles spent in the whole recursive-cycle, and its other subroutines, on the cycle count when that caller called a function in the recursive-cycle.

Page 28: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 28 CODE AURORA FORUM

Hexagon gprof Profiler Profiler Data

The calls field in the primary line for the recursive-cycle contains two values:

■ The number of times that functions in the recursive-cycle were called by functions outside the recursive-cycle.

■ The number of times that functions in the recursive-cycle were called by other functions in the recursive-cycle (including times when a function in the recursive-cycle calls itself).

This is a generalization of the usual split into nonrecursive and recursive calls.

The calls field of a subroutine-line for a recursive-cycle member in the recursive-cycle’s entry indicates how many time that function was called from functions in the recursive-cycle. The total of all these is the second number in the primary line’s calls field.

In the individual entry for a function in a recursive-cycle, the other functions in the same recursive-cycle can appear both as subroutines and as callers. These lines show how many times each function in the recursive-cycle called (or was called from) each other function in the recursive-cycle.

NOTE The self and children fields in these lines are blank because of the difficulty of defining meanings for them when recursion is going on.

Page 29: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 29 CODE AURORA FORUM

Hexagon gprof Profiler Profiler Data

3.4 Line-by-line profilingThe profiler command option -l causes the program to be displayed with line-by-line profiling. In this mode, histogram samples are assigned not to functions, but to individual lines of source code. The program usually must be compiled with a -g option to generate debugging symbols for tracking source code lines.

The flat profile is the most useful output table in line-by-line mode. The call graph isn’t as useful as normal, since the current version of the profiler does not propagate call graph arcs from source code lines to the enclosing function. The call graph does, however, show each line of code that called each function, along with a count.

The following example shows a section of the profiler’s output, without line-by-line profiling. Note that ct_init accounted for four histogram hits, and 13327 calls to init_block.

Flat profile:

Each sample counts as 1 cycle(s). % cumulative self self total time cycle(s) cycle(s) calls c/call c/call name 15.30 3184 3184 82 38.83 55.83 ct_init

Call graph (explanation follows)

granularity: each sample hit covers 4 byte(s) for 7.69% of 20808.00 cycles(s)

index % time self children called name

0.00 0.00 1/13496 name_too_long 0.00 0.00 40/13496 deflate 0.00 0.00 128/13496 deflate_fast 0.00 0.00 13327/13496 ct_init[7] 0.0 0.00 0.00 13496 init_block

Page 30: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 30 CODE AURORA FORUM

Hexagon gprof Profiler Profiler Data

The next example shows some of the profiler output from the same program run, this time with line-by-line profiling enabled. Note that ct_init’s four histogram hits are broken down into four lines of source code - one hit occurred on each of lines 349, 351, 382 and 385.

In the call graph, note how ct_init’s 13327 calls to init_block are broken down into one call from line 396, 3071 calls from line 384, 3730 calls from line 385, and 6525 calls from 387.

Flat profile:Each sample counts as 1 cycle(s). % cumulative self self total time cycle(s) cycle(s) calls c/call c/call name 6.54 9713 1360 ct_init (trees.c:349) 5.06 10766 1053 ct_init (trees.c:351) 4.68 11740 974 ct_init (trees.c:382) Call graph (explanation follows)

granularity: each sample hit covers 4 byte(s) for 7.69% 20808.00 cycle(s)

% time self children called name

0.00 0.00 1/13496 name_too_long (gzip.c:1440) 0.00 0.00 1/13496 deflate (deflate.c:763) 0.00 0.00 1/13496 ct_init (trees.c:396) 0.00 0.00 2/13496 deflate (deflate.c:727) 0.00 0.00 4/13496 deflate (deflate.c:686) 0.00 0.00 5/13496 deflate (deflate.c:675) 0.00 0.00 12/13496 deflate (deflate.c:679) 0.00 0.00 16/13496 deflate (deflate.c:730) 0.00 0.00 128/13496 deflate_fast (deflate.c:654) 0.00 0.00 3071/13496 ct_init (trees.c:384) 0.00 0.00 3730/13496 ct_init (trees.c:385) 0.00 0.00 6525/13496 ct_init (trees.c:387)[6] 0.0 0.00 0.00 13496 init_block (trees.c:408)

Page 31: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 31 CODE AURORA FORUM

Hexagon gprof Profiler Profiler Data

3.5 Annotated source listingThe profiler command option -A causes the profiler to display an annotated source listing, which lists the program’s source code so that each function is labeled by the number of times it was called.

NOTE You may also need to specify the -I option, if the profiler can’t find the source code files.

Compiling with the following command:

hexagon-gcc ... -g -a

... augments your program with basic-block counting code, in addition to function counting code. This enables the profiler to determine how many times each line of code was executed.

For example, consider the following function (taken from gzip) with line numbers added:

1 ulg updcrc(s, n) 2 uch *s; 3 unsigned n; 4 { 5 register ulg c; 6 7 static ulg crc = (ulg)0xffffffffL; 8 9 if (s == NULL) {10 c = 0xffffffffL;11 } else {12 c = crc;13 if (n) do {14 c = crc_32_tab[...];15 } while (--n);16 }17 crc = c;18 return c ^ 0xffffffffL;19 }

updcrc has at least five basic-blocks. One is the function itself. The if statement on line 9 generates two more basic-blocks, one for each branch of the if. A fourth basic-block results from the if on line 13, and the contents of the do loop form the fifth basic-block. The compiler may also generate additional basic-blocks to handle various special cases.

Page 32: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 32 CODE AURORA FORUM

Hexagon gprof Profiler Profiler Data

A program augmented for basic-block counting can be analyzed with hexagon-gprof -l -A. I also suggest use of the -x option, which ensures that each line of code is labeled at least once. Here is updcrc’s annotated source listing for a sample gzip run:

ulg updcrc(s, n) uch *s; unsigned n; 2 ->{ register ulg c; static ulg crc = (ulg)0xffffffffL; 2 -> if (s == NULL) { 1 -> c = 0xffffffffL; 1 -> } else { 1 -> c = crc; 1 -> if (n) do { 26312 -> c = crc_32_tab[...];26312,1,26311 -> } while (--n); } 2 -> crc = c; 2 -> return c ^ 0xffffffffL; 2 ->}

In this example, the function was called twice, passing once through each branch of the if statement. The body of the do loop was executed a total of 26312 times. Note how the while statement is annotated. It began execution 26312 times, once for each iteration through the loop. One of those times (the last time) it exited, while it branched back to the beginning of the loop 26311 times.

Page 33: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 33 CODE AURORA FORUM

4 Accuracy of Profiler Data

4.1 OverviewThe run-time information that the profiler generates is subject to inaccuracy. This chapter covers the following topics:

■ Profile time units

■ Call graph estimates

4.2 Profile time unitsBecause it measures cycle counts rather than time periods, the Hexagon processor version of gprof provides more accurate runtime information than the standard gprof version.

NOTE Future versions of gprof on the Hexagon processor may or may not include time-based measurements.

4.3 Call graph estimatesSome figures displayed in the call graph are only estimates: for example, the children cycle count values, and all the cycle count figures in caller and subroutine lines.

The profile data contains no direct information about these measurements. Therefore, the profiler must estimate them by making the following assumption: that the average time spent in each call to a function foo is not correlated to the functions that call foo. Thus, if foo uses 5 cycles in all, and 2/5 of the calls to foo came from function f, then foo is assumed to contribute 2 cycles to f’s children time.

This assumption is generally true; however, in certain cases it is far from true. For instance, suppose that foo returns very quickly when its argument value is zero, and that f always passes zero as an argument while the other callers of foo pass non-zero arguments. In this case all the time spent in foo is spent in the calls from callers other than f; but because the profiler has no way of knowing this, it will incorrectly assign 2 cycles of time in foo to the children of f.

NOTE Future versions of gprof will hopefully include more complete data in the profile data files (if and when we can determine how to implement this). For now, the call graph estimates are generally more useful than misleading.

Page 34: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 34 Qualcomm Proprietary & Confidential

MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION

5 Profiler Data Utilities

5.1 OverviewThe Hexagon processor software development tools include two software tools for manipulating the profile data files used by the profiler:

■ gmon file dumper – Converts binary profile data files (known as gmon files) into text files containing raw information on a program’s execution history, including histogram records, call-graph records, and basic-block execution count records.

■ gmon file merger – Merges two or more binary profile data files into a single binary profile data file.

Page 35: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 35 Qualcomm Proprietary & Confidential

MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION

Hexagon gprof Profiler Profiler Data Utilities

5.2 gmon file dumperThe gmon file dumper utility converts binary profile data files (known as gmon files) into text files containing the following raw information on a program’s execution history:

■ Histogram records

■ Call-graph records

■ Basic-block execution count records

5.2.1 Starting the gmon file dumperTo start the gmon file dumper from a command line, type:

hexagon-gmon-dump [options] profile_data_file

The profile data file for the program is specified on the command line by its file name (Section 2.2). Only one profile data file can be specified.

By default the gmon file dumper writes the converted profile information to the standard output. The information can be written to a text file by using the -o option.

5.2.2 Command options-h--help

Print help information.

-o filenameSpecify the output file that will contain the converted profile information.

The default file is the standard output.

-v-version

Print version information.

5.2.3 Input fileThe gmon file dumper accepts as input a single file known as a gmon performance profile data file (Section 2.2).

Page 36: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 36 Qualcomm Proprietary & Confidential

MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION

Hexagon gprof Profiler Profiler Data Utilities

5.2.4 Output fileThe Performance-Profile Text Datafile generated by the gmon file dumper is a straightforward translation of the input profile data file.

A gmon profile data file consists of several sections:

■ Header

■ Histogram records

■ Call-graph arc records

■ Basic-block records

5.2.4.1 Header

The header section contains a magic cookie value and a version number:

■ The standard GNU gmon format is version 1.

■ The enhanced Hexagon gmon format is version 2.

All data in a binary profile data file is stored in the native format of the host platform that the profile data file was generated on.

Header example:

File gmon.t_0:Header: cookie = 'g' 'm' 'o' 'n' ('gmon') version = 2

Record tag is GMON_TAG_TIME_HIST

5.2.4.2 Histogram records

Histogram records consist of a header record followed by an array of bins, where each bin is defined to represent an equal amount of text space.

A histogram record header contains the following items:

■ The text-segment range that the histogram covers

■ Size of the histogram in bytes (not including the header size)

■ Profiling clock rate

■ Physical dimensions that the bin-counts represent (after being scaled by the profiling clock rate)

For example, if the text-segment is 1000 bytes long, and if the histogram contains 10 bins, then each bin represents 100 bytes. By default one bin exists per instruction.

Page 37: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 37 Qualcomm Proprietary & Confidential

MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION

Hexagon gprof Profiler Profiler Data Utilities

Histogram record example:

Histogram header: PC range (0x1e001120 - 0x1e01f7f0) Histogram size = 31156 (0x79b4) Profiling rate = 1 (1.000000) Dimension = ' 1.00*cyc', abbreviation = 'c' 0x0000: 0x0fab ( 4011) 0x0001: 0x0000 ( 0) 0x0002: 0x0fab ( 4011) 0x0003: 0x0000 ( 0) 0x0004: 0x0000 ( 0) 0x0005: 0x0fab ( 4011) 0x0006: 0x0fab ( 4011) . . . 0x79b2: 0x0087 ( 135) 0x79b3: 0x0085 ( 133)Histogram total = 0xc9d06a (13226090)Max histogram value = 0xf4240 (1000000)

5.2.4.3 Call-graph records

Call-graph records consist of the following items:

■ An arc in the call graph

■ A value indicating the number of times that the arc was traversed during program execution

Arcs are specified by address pairs: the first address is in the calling function, while the second is in the called function.

Call-graph record example:

Record tag is GMON_TAG_CG_ARC ARC from 0x1e00b240 to 0x1e00cb80 count = 2

Record tag is GMON_TAG_CG_ARC ARC from 0x1e00cb80 to 0x1e00a9e0 count = 3372

Record tag is GMON_TAG_CG_ARC ARC from 0x1e00d440 to 0x1e00cb80 count = 3370...Record tag is GMON_TAG_CG_ARC ARC from 0x1e01688c to 0x1e01afe0 count = 1

Record tag is GMON_TAG_CG_ARC ARC from 0x1e01b094 to 0x1e01afe0 count = 1

Record tag is GMON_TAG_BB_COUNT

Page 38: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 38 Qualcomm Proprietary & Confidential

MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION

Hexagon gprof Profiler Profiler Data Utilities

5.2.4.4 Basic-block records

Basic-block records consist of a header followed by a sequence of address/count pairs.

A basic-block record header contains a single item: the length of the address/count pair sequence.

In each address/count pair, the address value identifies a basic-block, while the count value specifies the number of times that the basic-block was executed.

Basic-block record example:

BB record count = 2555 (0x09fb) BB PC = 0x1e001120, count = 4011 (0x00000fab) BB PC = 0x1e001128, count = 4011 (0x00000fab) BB PC = 0x1e001134, count = 4011 (0x00000fab) BB PC = 0x1e001138, count = 4011 (0x00000fab) . . . BB PC = 0x1e016d64, count = 1 (0x00000001) BB PC = 0x1e0181e0, count = 1 (0x00000001) BB PC = 0x1e0181e8, count = 1 (0x00000001) BB PC = 0x1e01b094, count = 1 (0x00000001)BB Total = 0x00c9d06a (13226090)Max BB value = 0xf4240 (1000000)

Page 39: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 39 Qualcomm Proprietary & Confidential

MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION

Hexagon gprof Profiler Profiler Data Utilities

5.3 gmon file mergerThe gmon file merger utility merges two or more binary profile data files into a single binary profile data file.

5.3.1 Starting the gmon file mergerTo start the Hexagon gmon Merge Utility from a command line, type:

hexagon-gmon-merge [options] profile_data_files ...

The profile data files are specified on the command line by their file names (Section 2.2). Two or more profile data files can be specified.

The default name of the merged file is gmon.sum.

A different name can be specified with the -o option.

5.3.2 Command options-h--help

Print help information.

-o filenameSpecify the output file that will contain the merged profile data.

The default file is gmon.sum.

-v-version

Print version information

5.3.3 Input filesThe gmon file merger accepts as input two or more profile files known as gmon performance profile data files (Section 2.2).

5.3.4 Output fileThe Performance-Profile Text Datafile generated by the gmon file merger is a combination of all of the input files. This single file produced can be used just like any other gmon file.

Page 40: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 40 CODE AURORA FORUM

6 Frequently Asked Questions

6.1 OverviewThis chapter presents some frequently-asked questions about the profiler.

How do I find which lines in my program were executed the most times?

Compile your program with basic-block counting enabled, run it, then use the following pipeline:

hexagon-gprof -l -C objfile | sort -k 3 -n -r

This listing will show you the lines in your code executed most often, but not necessarily those that consumed the most time.

How do I find which lines in my program called a particular function?

Run gprof with line-by-line profiling enabled, and look up the function in the call graph. The callers will be broken down by function and line number.

How do I analyze a program that runs for less than one second?

With gprof this is not an issue – all cycle counts are accurate.

How does gprof handle assembly language labels?

If a linked program contains multiple instances of an internally-used local label (for instance, Loop_Start), gprof will aggregate the profile data for all the label instances as if they were a single function with the specified label name.

To avoid this problem, be sure that all internal labels used in assembly code are declared with temporary symbols rather than local symbols. This will ensure that the profile data in question (e.g., cycle counts) is properly associated with the corresponding function labels rather than the single internal label.

For more information on temporary symbols see the Hexagon Binutils document.

Page 41: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 41 CODE AURORA FORUM

7 Incompatibilities with UNIX gprof

7.1 OverviewGNU gprof and Berkeley UNIX gprof use the same data file gmon.out, and provide essentially the same information. But there are a few differences:

■ GNU gprof uses a new, generalized file format with support for basic-block execution counts and non-realtime histograms. It also does not scale the histogram data to 16 bits; rather it keeps an absolute cycle count per histogram bucket.

■ For a recursive function, UNIX gprof lists the function as a parent and as a child, with a calls field that lists the number of recursive calls. GNU gprof omits these lines and puts the number of recursive calls in the primary line.

■ When a function is suppressed from the call graph with -e, GNU gprof still lists it as a subroutine of functions that call it.

■ GNU gprof accepts the -k with its argument in the form from/to, instead of from to.

■ In the annotated source listing, if there are multiple basic blocks on the same line, GNU gprof prints all of their counts, separated by commas.

■ The blurbs, field widths, and output formats are different. GNU hexagon-prof prints blurbs after the tables, so that you can see the tables without skipping the blurbs.

Page 42: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 42 CODE AURORA FORUM

8 Processor-Specific Features

8.1 OverviewThe profiler supports several features which are unique to the implementation of gprof on the Hexagon processor:

■ Accept multiple executable files as input (Section 2.2)

■ Processor-specific profile data format (Section 2.5)

■ Merge multiple profile data files with differing formats (Section 2.5)

■ Display profile information in units of cycles instead of seconds (Chapter 3)

Page 43: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 43 CODE AURORA FORUM

A Acknowledgments

A.1 OverviewThis appendix lists the people who contributed to the development of the profiler, and to the development of the document on which this one is based. The following section was copied from the acknowledgment section in the original source document.

A.2 ProfilerGNU gprof was developed by Jay Fenlason.

Jay Fenlason and Richard Stallman wrote the GNU gprof manual, with editing by Jeffrey Osier and an update by Brent Baccala.

Page 44: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 44 CODE AURORA FORUM

B License Statements

B.1 History

Title Year Authors Publisher Network LocationGNU gprof, the GNU Profiler

1988, 1992, 1997, 1998

Jay Fenlason, Richard Stallman

Free Software Foundation, Inc.

http://ftp.gnu.org/gnu/gdb/gdb-6.1.tar.gz

Hexagon gprof Profiler User Guide, A GNU Manual

2008, 2009, 2010

Jay Fenlason, Richard Stallman, QUALCOMM Incorporated

QUALCOMM Incorporated

Source files supplied directly to users

Hexagon gprof Profiler, A GNU Manual

2010, 2011 Jay Fenlason, Richard Stallman, QUALCOMM Incorporated, Qualcomm Innovation Center, Inc.

Code Aurora Forum

Source files supplied directly to users

Page 45: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 45 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

B.2 Free softwareGDB is free software, protected by the GNU General Public License (GPL). The GPL gives you the freedom to copy or adapt a licensed program—but every person getting a copy also gets with it the freedom to modify that copy (which means that they must get access to the source code), and the freedom to distribute further copies. Typical software companies use copyrights to limit your freedoms; the Free Software Foundation uses the GPL to preserve these freedoms.

Fundamentally, the General Public License is a license which says that you have these freedoms and that you cannot take these freedoms away from anyone else.

B.3 Free software needs free documentationThe biggest deficiency in the free software community today is not in the software—it is the lack of good free documentation that we can include with the free software. Many of our most important programs do not come with free reference manuals and free introductory texts. Documentation is an essential part of any software package; when an important free software package does not come with a free manual and a free tutorial, that is a major gap. We have many such gaps today.

Consider Perl, for instance. The tutorial manuals that people normally use are non-free. How did this come about? Because the authors of those manuals published them with restrictive terms—no copying, no modification, source files not available—which exclude them from the free software world.

That wasn’t the first time this sort of thing happened, and it was far from the last. Many times we have heard a GNU user eagerly describe a manual that he is writing, his intended contribution to the community, only to learn that he had ruined everything by signing a publication contract to make it non-free.

Free documentation, like free software, is a matter of freedom, not price. The problem with the non-free manual is not that publishers charge a price for printed copies—that in itself is fine. (The Free Software Foundation sells printed copies of manuals, too.) The problem is the restrictions on the use of the manual. Free manuals are available in source code form, and give you permission to copy and modify. Non-free manuals do not allow this.

The criteria of freedom for a free manual are roughly the same as for free software. Redistribution (including the normal kinds of commercial redistribution) must be permitted, so that the manual can accompany every copy of the program, both on-line and on paper.

Permission for modification of the technical content is crucial too. When people modify the software, adding or changing features, if they are conscientious they will change the manual too—so they can provide accurate and clear documentation for the modified program. A manual that leaves you no choice but to write a new manual to document a changed version of the program is not really available to our community.

Page 46: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 46 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

Some kinds of limits on the way modification is handled are acceptable. For example, requirements to preserve the original author’s copyright notice, the distribution terms, or the list of authors, are ok. It is also no problem to require modified versions to include notice that they were modified. Even entire sections that may not be deleted or changed are acceptable, as long as they deal with nontechnical topics (like this one). These kinds of restrictions are acceptable because they don’t obstruct the community’s normal use of the manual.

However, it must be possible to modify all the technical content of the manual, and then distribute the result in all the usual media, through all the usual channels. Otherwise, the restrictions obstruct the use of the manual, it is not free, and we need another manual to replace it.

Please spread the word about this issue. Our community continues to lose manuals to proprietary publishing. If we spread the word that free software needs free reference manuals and free tutorials, perhaps the next person who wants to contribute by writing documentation will realize, before it is too late, that only free manuals contribute to the free software community.

If you are writing documentation, please insist on publishing it under the GNU Free Documentation License or another free documentation license. Remember that this decision requires your approval—you don’t have to let the publisher decide. Some commercial publishers will use a free license if you insist, but they will not propose the option; it is up to you to raise the issue and say firmly that this is what you want. If the publisher you are dealing with refuses, please try other publishers. If you’re not sure whether a proposed license is free, write to [email protected].

You can encourage commercial publishers to sell more free, copylefted manuals and tutorials by buying them, and particularly by buying copies from the publishers that paid for their writing or for major improvements. Meanwhile, try to avoid buying non-free documentation at all. Check the distribution terms of a manual before you buy it, and insist that whoever seeks your business must respect your freedom. Check the history of the book, and try to reward the publishers that have paid or pay the authors to work on it.

■ The Free Software Foundation maintains a list of free documentation published by other publishers, at http://www.fsf.org/doc/other-free-books.html.

Page 47: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 47 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

B.4 GNU GENERAL PUBLIC LICENSEVersion 2, June 1991

Copyright © 1989, 1991 Free Software Foundation, Inc.59 Temple Place - Suite 330, Boston, MA 02111-1307, USA

Everyone is permitted to copy and distribute verbatim copiesof this license document, but changing it is not allowed.

B.4.1 PreambleThe licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software—to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation’s software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author’s protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors’ reputations.

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone’s free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow.

Page 48: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 48 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The “Program”, below, refers to any such program or work, and a “work based on the Program” means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term “modification”.) Each licensee is addressed as “you”.

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

You may copy and distribute verbatim copies of the Program’s source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.

You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.

If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)

Page 49: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 49 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,

Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

Page 50: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 50 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients’ exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

Page 51: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 51 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and “any later version”, you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

NO WARRANTY

BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS

Page 52: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 52 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

B.4.2 How to apply these terms to your new programsIf you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.

one line to give the program's name and a brief idea of what it does.Copyright (C) year name of author

This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.

This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.

You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330,Boston, MA 02111-1307, USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this when it starts in an interactive mode:

Gnomovision version 69, Copyright (C) year name of authorGnomovision comes with ABSOLUTELY NO WARRANTY; for detailstype `show w'.This is free software, and you are welcome to redistribute itunder certain conditions; type `show c' for details.

The hypothetical commands show w and show c should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than show w and show c; they could even be mouse-clicks or menu items—whatever suits your program.

Page 53: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 53 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

You should also get your employer (if you work as a programmer) or your school, if any, to sign a “copyright disclaimer” for the program, if necessary. Here is a sample; alter the names:

Yoyodyne, Inc., hereby disclaims all copyright interest in the program`Gnomovision' (which makes passes at compilers) written by James Hacker.

signature of Ty Coon, 1 April 1989Ty Coon, President of Vice

This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.

B.5 GNU FREE DOCUMENTATION LICENSEVersion 1.2, November 2002

Copyright © 2000,2001,2002 Free Software Foundation, Inc.59 Temple Place, Suite 330, Boston, MA 02111-1307, USA

Everyone is permitted to copy and distribute verbatim copiesof this license document, but changing it is not allowed.

PREAMBLE

The purpose of this License is to make a manual, textbook, or other functional and useful document free in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.

This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.

We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.

Page 54: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 54 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

APPLICABILITY AND DEFINITIONS

This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.

A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.

A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document’s overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.

The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.

The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.

A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not “Transparent” is called “Opaque”.

Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.

Page 55: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 55 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work’s title, preceding the beginning of the body of the text.

A section “Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” of such a section when you modify the Document means that it remains a section “Entitled XYZ” according to this definition.

The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.

VERBATIM COPYING

You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.

You may also lend copies, under the same conditions stated above, and you may publicly display copies.

COPYING IN QUANTITY

If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.

If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.

Page 56: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 56 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.

It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.

MODIFICATIONS

You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:

Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.

List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement.

State on the Title page the name of the publisher of the Modified Version, as the publisher.

Preserve all the copyright notices of the Document.

Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.

Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.

Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document’s license notice.

Include an unaltered copy of this License.

Preserve the section Entitled “History”, Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled “History” in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.

Page 57: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 57 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the “History” section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.

For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.

Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.

Delete any section Entitled “Endorsements”. Such a section may not be included in the Modified Version.

Do not retitle any existing section to be Entitled “Endorsements” or to conflict in title with any Invariant Section.

Preserve any Warranty Disclaimers.

If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version’s license notice. These titles must be distinct from any other section titles.

You may add a section Entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.

You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.

The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.

COMBINING DOCUMENTS

You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.

Page 58: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 58 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.

In the combination, you must combine any sections Entitled “History” in the various original documents, forming one section Entitled “History”; likewise combine any sections Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections Entitled “Endorsements.”

COLLECTIONS OF DOCUMENTS

You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.

You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.

AGGREGATION WITH INDEPENDENT WORKS

A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an “aggregate” if the copyright resulting from the compilation is not used to limit the legal rights of the compilation’s users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.

If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document’s Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.

TRANSLATION

Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.

Page 59: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 59 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.

TERMINATION

You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

FUTURE REVISIONS OF THIS LICENSE

The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.

Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.

B.5.1 ADDENDUM: How to use this license for your documentsTo use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:

Copyright (C) year your name. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''.

If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the “with...Texts.” line with this:

with the Invariant Sections being list their titles, withthe Front-Cover Texts being list, and with the Back-Cover Textsbeing list.

If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation.

Page 60: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 60 CODE AURORA FORUM

Hexagon gprof Profiler License Statements

If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.

Page 61: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

80-N2040-4 Rev. C 61 CODE AURORA FORUM

Index

@filename 16% time 20% time 22-a 14-A[symspec] 12--all-lines 14--annotated-source[=symspec] 12-b 12--brief 12-c 14-C[symspec] 12called 23called 23called 24calls 20children 22children 23children 24cumulative cycle(s) 20-D 14--demangle 12--directory-path=dirs 13--display-unused-functions 15--exec-counts[=symspec] 12--external-symbol-table=filename 15--file-format=name 15--file-info 13--file-ordering map_file 12--flat-profile[=symspec] 13--function-ordering 13--graph[=symspec] 13-h 35-h 39--help 35--help 39-i 13-I dirs 13--ignore-non-functions 14index 22-J[symspec] 13-k from/to 14-L 13-l 15--line 15-m num 15--min-count=num 15-N[symspec] 15

-n[symspec] 15name 21name 23name 24name and index number 23--no-annotated-source[=symspec] 13--no-demangle 12--no-exec-counts[=symspec] 14--no-flat-profile[=symspec] 13--no-graph[=symspec] 13--no-static 14--no-time[=symspec] 15-o filename 35-o filename 39-Oname 15-P[symspec] 13-p[symspec] 13--print-path 13-Q[symspec] 13-q[symspec] 13-s 15self 22self 23self 24self cycle(s) 20self Mc/call 20--separate-files 14-Sfilename 15--static-call-graph 14--sum 15-T 13--time[=symspec] 15total Mc/call 21--traditional 13-v 15-v 35-v 39--version 15-version 35-version 39-w width 14--width=width 14-x 14-y 14-z 15-Z[symspec] 14

Page 62: Hexagon gprof Profiler · Hexagon Graphical Profiler User Guide, Hexagon Simulator User Guide (region profiling section), and Hexagon Code Coverage Profiler User Guide. The gprof

Published by Code Aurora Forum.

You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development.