snippetbashTip
gprof — Performance analysis tool for many programming languages. It profiles the function executions of a p
Viewed 0 times
commandanalysismanyclitoolperformanceforgprof
Problem
How to use the
gprof command: Performance analysis tool for many programming languages. It profiles the function executions of a program. More information: <https://ftp.gnu.org/old-gnu/Manuals/gprof/html_mono/gprof.html>.Solution
gprof — Performance analysis tool for many programming languages. It profiles the function executions of a program. More information: <https://ftp.gnu.org/old-gnu/Manuals/gprof/html_mono/gprof.html>.Compile binary to default
a.out with gprof information and run it to get gmon.out:gcc {{[-p|-pg]}} {{program.c}} && ./a.outRun gprof on default
a.out and gmon.out to obtain profile output:gprofRun gprof on a named binary:
gprof {{path/to/binary}} {{path/to/gmon.out}}Suppress profile field's description:
gprof {{[-b|--brief]}}Display routines that have zero usage:
gprof {{[-bz|--brief --display-unused-functions]}}Code Snippets
Compile binary to default `a.out` with gprof information and run it to get `gmon.out`
gcc {{[-p|-pg]}} {{program.c}} && ./a.outRun gprof on default `a.out` and `gmon.out` to obtain profile output
gprofRun gprof on a named binary
gprof {{path/to/binary}} {{path/to/gmon.out}}Suppress profile field's description
gprof {{[-b|--brief]}}Display routines that have zero usage
gprof {{[-bz|--brief --display-unused-functions]}}Context
tldr-pages: common/gprof
Revisions (0)
No revisions yet.