cg_annotate - Man Page

post-processing tool for Cachegrind

Synopsis

cg_annotate [options] cachegrind-out-file [source-files...]

Description

cg_annotate takes one or more Cachegrind output files and prints data about the profiled program in an easy-to-read form​.

Options

-h --help

Show the help message​.

--version

Show the version number​.

--diff

Diff two Cachegrind output files​.

--mod-filename <regex> [default: none]

Specifies an s/old/new/ search-and-replace expression that is applied to all filenames​. Useful when differencing, for removing minor differences in paths between two different versions of a program that are sitting in different directories​. An i suffix makes the regex case-insensitive, and a g suffix makes it match multiple times​.

--mod-funcname <regex> [default: none]

Like --mod-filename, but for filenames​. Useful for removing minor differences in randomized names of auto-generated functions generated by some compilers​.

--show=A,B,C [default: all, using order in the Cachegrind output file]

Specifies which events to show (and the column order)​. Default is to use all present in the Cachegrind output file (and use the order in the file)​. Best used in conjunction with --sort​.

--sort=A,B,C [default: order in the Cachegrind output file]

Specifies the events upon which the sorting of the file:function and function:file entries will be based​.

--threshold=X [default: 0​.1%]

Sets the significance threshold for the file:function and function:files sections​. A file or function is shown if it accounts for more than X% of the counts for the primary sort event​. If annotating source files, this also affects which files are annotated​.

--show-percs,  --no-show-percs,  --show-percs=<no|yes> [default: yes]

When enabled, a percentage is printed next to all event counts​. This helps gauge the relative importance of each function and line​.

--annotate,  --no-annotate,  --auto=<no|yes> [default: yes]

Enables or disables source file annotation​.

--context=N [default: 8]

The number of lines of context to show before and after each annotated line​. Use a large number (e​.g​. 100000) to show all source lines​.

See Also

valgrind(1), $INSTALL/share/doc/valgrind/html/index​.html or http://www​.valgrind​.org/docs/manual/index​.html​.

Author

Nicholas Nethercote​.

Info

05/20/2026 Release 3.27.1