\input texinfo @c -*-texinfo-*-
@setfilename gprof.info
-@c Copyright (C) 1988-2017 Free Software Foundation, Inc.
+@c Copyright (C) 1988-2022 Free Software Foundation, Inc.
@settitle GNU gprof
@setchapternewpage odd
This file documents the gprof profiler of the GNU system.
@c man begin COPYRIGHT
-Copyright @copyright{} 1988-2017 Free Software Foundation, Inc.
+Copyright @copyright{} 1988-2022 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
Eric S. Raymond made some minor corrections and additions in 2003.
@vskip 0pt plus 1filll
-Copyright @copyright{} 1988-2017 Free Software Foundation, Inc.
+Copyright @copyright{} 1988-2022 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
@smallexample
@c man begin SYNOPSIS
-gprof [ -[abcDhilLrsTvwxyz] ] [ -[ACeEfFJnNOpPqQZ][@var{name}] ]
+gprof [ -[abcDhilLrsTvwxyz] ] [ -[ACeEfFJnNOpPqQRStZ][@var{name}] ]
[ -I @var{dirs} ] [ -d[@var{num}] ] [ -k @var{from/to} ]
[ -m @var{min-count} ] [ -R @var{map_file} ] [ -t @var{table-length} ]
[ --[no-]annotated-source[=@var{name}] ]
segmentation fault as soon as it is run. The solution is to link
against a static version of the library containing the profiling
support code, which for @code{gcc} users can be done via the
-@samp{-static} or @samp{-static-libgcc} command line option. For
+@samp{-static} or @samp{-static-libgcc} command-line option. For
example:
@example
@code{gprof}. @xref{Line-by-line, ,Line-by-line Profiling}.
It also worth noting that @code{gcc} implements a
-@samp{-finstrument-functions} command line option which will insert
+@samp{-finstrument-functions} command-line option which will insert
calls to special user supplied instrumentation routines at the entry
and exit of every function in their program. This can be used to
implement an alternative profiling scheme.
Your program will write the profile data into a file called @file{gmon.out}
just before exiting. If there is already a file called @file{gmon.out},
-its contents are overwritten. There is currently no way to tell the
-program to write the profile data under a different name, but you can rename
-the file afterwards if you are concerned that it may be overwritten.
+its contents are overwritten. You can rename the file afterwards if you
+are concerned that it may be overwritten. If your system libc allows you
+may be able to write the profile data under a different name. Set the
+GMON_OUT_PREFIX environment variable; this name will be appended with
+the PID of the running program.
In order to write the @file{gmon.out} file properly, your program must exit
normally: by returning from @code{main} or by calling @code{exit}. Calling
compiled with a @samp{-g} option, in addition to @samp{-pg}, in order
to generate debugging symbols for tracking source code lines.
Note, in much older versions of @code{gcc} the program had to be
-compiled with the @samp{-a} command line option as well.
+compiled with the @samp{-a} command-line option as well.
The flat profile is the most useful output table
in line-by-line mode.
@section Profiling Data File Format
The old BSD-derived file format used for profile data does not contain a
-magic cookie that allows to check whether a data file really is a
+magic cookie that allows one to check whether a data file really is a
@code{gprof} file. Furthermore, it does not provide a version number, thus
rendering changes to the file format almost impossible. @sc{gnu} @code{gprof}
uses a new file format that provides these features. For backward