GCOV-TOOL(1)

πŸ“¦
version 11.5.0 Β· 3 versions
, in ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸŽ€ GCOV-TOOL(1) πŸŽ€

GNU manual page for gcov-tool, section 1 πŸ’–

✨ NAME ✨

gcov-tool - offline gcda profile processing tool 🧚

🧚 SYNOPSIS 🧚

Okay so there are four forms you can call: the bare one for version and help, plus three subcommands, merge, rewrite, and overlap πŸ’…

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 πŸ¦‹

Bestie, gcov-tool is an offline tool for processing gcc's gcda profile files. It's giving productivity πŸ’–

It can do two main things rn:

  • 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 🌸

Here's when you'd actually reach for it:

  • Collect profiles for different sets of inputs, then use this tool to merge them. You can give each input a weight to show how much it matters relative to the others πŸ‘‘
  • Rewrite the profile after removing a subset of the gcda files, and it keeps the summary and the histogram consistent 🫢
  • It can also be used to debug or libgcov code, since the tool shares most of its code with the runtime library πŸ”₯
Ngl, one thing to know: merging offline might give you slightly different values than the online merged profile. Here are the typical differences, iykyk πŸ‘€
  • Histogram difference: This offline tool recomputes the histogram after merging the counters, so the resulting histogram is precise ✨. The online merging doesn't have this capability, though. Its histogram is merged from two histograms, so the result is an approximation πŸ™ˆ.
  • Summary checksum difference: The summary checksum uses a CRC32 operation πŸ’…. The value depends on the link list order of gcov-info objects, and that order is different in gcov-tool than in the online merge. So it's expected to get different summary checksums. Honestly it doesn't really matter, because the compiler doesn't use this checksum anywhere πŸ’€.
  • Value profile counter values difference: Some value profile counters are runtime dependent, like heap addresses. It's totally normal to see some difference in these kinds of counters πŸ¦‹.

πŸ‘‘ OPTIONS πŸ‘‘

  • -h, --help β€” Shows you the help for using gcov-tool on standard output, then exits without doing any further processing 🌈.
  • -v, --version β€” Shows the gcov-tool version number on standard output, then exits without doing any further processing πŸ’–.
  • merge β€” Merges two profile directories πŸŽ€.
    • -o directory, --output directory β€” Sets the output profile directory. The default output directory name is merged_profile πŸ“.
    • -v, --verbose β€” Turns on verbose mode πŸ“£.
    • -w w1,w2, --weight w1,w2 β€” Sets the merge weights of directory1 and directory2, respectively. The default weights are 1 for both 🌸.
  • rewrite β€” Reads the specified profile directory and rewrites it to a new directory 🧚.
    • -n long_long_value, --normalize <long_long_value> β€” Normalizes the profile. The value you pass is the max counter value in the new profile ✨.
    • -o directory, --output directory β€” Sets the output profile directory. 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 pass 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 two specified profile directories. The overlap score is based on the arc profiles, and it's defined as this, periodt πŸ¦‹:
sum of min (p1_counter[i] / p1_sum_all, p2_counter[i] / p2_sum_all), for all arc counter i, where p1_counter[i] and p2_counter[i] are two matched counters and p1_sum_all and p2_sum_all are the sum 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 the hot counter value πŸ‘‘.
  • -v, --verbose β€” Turns on verbose mode πŸ“£.

🌈 SEE ALSO 🌈

gpl(7), gfdl(7), fsf-funding(7), gcc(1), gcov(1) and the Info entry for gcc πŸ’œ.

Copyright (c) 2014-2021 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 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 texts are (a) (see below), and the Back-Cover Texts are (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.

That's the whole tea, bestie πŸ’– This page is from gcc-11.5.0, dated 2024-07-19, and it's the GCOV-TOOL(1) manual. Go forth and profile something iconic 🧚✨πŸ’