GCOV-TOOL(1)

๐Ÿ“ฆ
version 10.5.0 ยท 2 versions
, in ubuntu jammy, ubuntu noble

โœจ GCOV-TOOL(1) โœจ

Okay bestie, this is the manual page for gcov-tool, the GNU tool for poking at gcc's gcda profile files ๐Ÿงš๐Ÿ’–. It's a manual page, which means it's the official docs, so buckle up ๐Ÿ’….

๐ŸŽ€ NAME

gcov-tool is an offline gcda profile processing tool. It works on the files after the fact, no running program needed ๐Ÿฆ‹.

๐ŸŒธ SYNOPSIS

Here's every way you can call it, no cap ๐Ÿ‘‘:

gcov-tool [-v|--version] [-h|--help]

gcov-tool merge [merge-options] directory1 directory2
     [-o|--output directory]
     [-v|--verbose]
     [-w|--weight w1,w2]

gcov-tool rewrite [rewrite-options] directory
     [-n|--normalize long_long_value]
     [-o|--output directory]
     [-s|--scale float_or_simple-frac_value]
     [-v|--verbose]

gcov-tool overlap [overlap-options] directory1 directory2
     [-f|--function]
     [-F|--fullname]
     [-h|--hotonly]
     [-o|--object]
     [-t|--hot_threshold] float
     [-v|--verbose]

๐Ÿ’œ DESCRIPTION

Okay so gcov-tool is an offline tool for processing gcc's gcda profile files ๐Ÿ”ฅ. Right now it can do two main things:

  • merge two sets of profiles, with weights โš–๏ธ.
  • read one set of profile and rewrite the profile contents. You can scale or normalize the count values ๐Ÿ“.

The use cases are lowkey iconic ๐Ÿ˜ญ:

  • Collect profiles for different sets of inputs and merge them together. You can set a weight to show how much each input matters โœจ.
  • Rewrite the profile after dropping a subset of the gcda files, while keeping the summary and the histogram consistent ๐Ÿซถ.
  • It can also help you debug libgcov code, since the tool shares most of its code with the runtime library ๐Ÿงš.
Heads up, bestie: an offline merge might not match the online merged profile exactly. Here are the usual suspects ๐Ÿ‘€:
  • Histogram difference: The offline tool recalculates the histogram after merging the counters, so the result is precise ๐Ÿ’…. Online merging doesn't have that power. It merges two histograms into one, and the result is just an approximation ๐Ÿ™ˆ.
  • Summary checksum difference: The summary checksum uses a CRC32 operation, and its value depends on the link list order of gcov-info objects. gcov-tool orders them differently than the online merge does, so you'll see different checksums. Honestly it doesn't really matter, because the compiler never uses this checksum anywhere ๐Ÿ’€โœจ.
  • Value profile counter difference: Some value profile counters depend on the runtime, like heap addresses. Seeing differences in these is totally normal ๐ŸŒˆ.

๐Ÿฆ‹ OPTIONS

  • -h, --help โ€” Shows you the help text on stdout, then exits without doing anything else ๐Ÿ™‹.
  • -v, --version โ€” Shows the gcov-tool version number on stdout, then exits without doing anything else ๐Ÿ”ข.

๐Ÿ“ merge

Merges two profile directories together ๐Ÿ’–.

  • -o directory, --output directory โ€” Sets the output profile directory. If you don't pick one, it defaults to merged_profile ๐Ÿ“.
  • -v, --verbose โ€” Turns on verbose mode ๐Ÿ“ข.
  • -w w1,w2, --weight w1,w2 โ€” Sets the merge weights for directory1 and directory2, in that order. Both default to 1 โš–๏ธ.

๐ŸŒท rewrite

Reads the profile directory you specify and rewrites it into a new one ๐Ÿ”.

  • -n long_long_value, --normalize <long_long_value> โ€” Normalizes the profile. The number you give is the max counter value in the new profile ๐Ÿ“.
  • -o directory, --output directory โ€” Sets the output profile directory. If you don't pick one, the default output name is rewrite_profile ๐Ÿ“.
  • -s float_or_simple-frac_value, --scale float_or_simple-frac_value โ€” Scales the profile counters. You can use a floating point value or a simple fraction, like 1, 2, 2/3, and 5/3 ๐Ÿงฎ.
  • -v, --verbose โ€” Turns on verbose mode ๐Ÿ“ข.

๐Ÿงš overlap

Computes the overlap score between the two profile directories you specify ๐Ÿซง. The score is based on the arc profiles, and it's defined as the sum of min (p1_counter[i] / p1_sum_all, p2_counter[i] / p2_sum_all) for all arc counters i. Here p1_counter[i] and p2_counter[i] are the two matched counters, and p1_sum_all and p2_sum_all are the sums of counter values in profile 1 and profile 2 respectively ๐Ÿค“.

  • -f, --function โ€” Prints the function level overlap score ๐ŸŽฏ.
  • -F, --fullname โ€” Prints the full gcda filename ๐Ÿ“œ.
  • -h, --hotonly โ€” Only prints info for hot objects and functions ๐Ÿ”ฅ.
  • -o, --object โ€” Prints the object level overlap score ๐Ÿงฑ.
  • -t float, --hot_threshold <float> โ€” Sets the threshold for a hot counter value ๐ŸŒก๏ธ.
  • -v, --verbose โ€” Turns on verbose mode ๐Ÿ“ข.

โญ SEE ALSO

Check these out for more tea โ˜•: gpl(7), gfdl(7), fsf-funding(7), gcc(1), gcov(1), and the Info entry for gcc ๐Ÿ“š.

Copyright (c) 2014-2020 Free Software Foundation, Inc. ๐Ÿ’œ

You can copy, distribute, and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation. The Invariant Sections are "GNU General Public License" and "Funding Free Software", the Front-Cover Text is (a) (see below), and the Back-Cover Text is (b) (see below). A copy of the license is included in the gfdl(7) man page ๐Ÿ“–.

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF'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.

Bestie, that's the whole page, and it's from gcc-10.5.0 dated 2023-07-07 ๐Ÿ’–โœจ You're officially gcov-tool literate now ๐Ÿซถ๐Ÿ’…

๐Ÿ“ฆ where this page comes from