GCOV-TOOL(1)

๐Ÿ“ฆ
version 16-20260322 ยท 2 versions
, in ubuntu resolute

๐Ÿ’– GCOV-TOOL(1) ๐Ÿ’–

GNU manual page, bestie ๐ŸŽ€ Okay so this one's all about gcov-tool, an offline tool for processing gcc's gcda profile files ๐Ÿ’…

โœจ NAME โœจ

gcov-tool - offline gcda profile processing tool ๐Ÿฆ‹

โœจ SYNOPSIS โœจ

Here's how you 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 merge-stream [merge-stream-options] [file]
     [-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 โœจ

So gcov-tool is an offline tool that processes gcc's gcda profile files, and it's giving main character energy ๐ŸŒธ

Right now it can do three things:

  • merge two sets of profiles with weights ๐Ÿ’œ
  • read a stream of profiles with associated filenames and merge it with a set of profiles with weights ๐Ÿงš
  • read one set of profile and rewrite the profile contents. You can scale or normalize the count values โœจ

Here are some use cases that are lowkey perfect:

  • Collect profiles for different sets of inputs, then merge them with this tool. You can give each input a weight to show how important it is relative to the others ๐Ÿ“
  • Collect profiles from target systems that don't have a filesystem (freestanding environments). Merge those with the associated profiles on the host system. You can give each input a weight to show its relative importance ๐Ÿซถ
  • Rewrite the profile after removing a subset of the gcda files, while keeping the summary and histogram consistent ๐ŸŽ€
  • It can also help you debug libgcov code, since the tool shares most of its code with the runtime library ๐Ÿ”ฅ

Now, bestie, the merged profile from this offline tool might have slightly different values than the online merged profile. Here are the typical differences:

  • histogram difference: This offline tool recomputes the histogram after merging the counters, so the resulting histogram is precise. The online merge can't do that. It merges two histograms together, so the result is an approximation ๐Ÿ“Š
  • summary checksum difference: The summary checksum uses a CRC32 operation. Its 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 you should expect different summary checksums. It doesn't really matter though, because the compiler doesn't use this checksum anywhere ๐Ÿ’…
  • value profile counter values difference: Some value profile counters depend on the runtime, like heap addresses. It's totally normal to see differences in these kinds of counters ๐ŸŒˆ

โœจ OPTIONS โœจ

  • -h, --help โ€” Shows you how to use gcov-tool (on the standard output), then exits without doing any more processing ๐Ÿ™ˆ
  • -v, --version โ€” Shows the gcov-tool version number (on the standard output), then exits without doing any more processing ๐Ÿ”ฅ

๐ŸŽ€ merge

Merges two profile directories. Literally that's it ๐Ÿ’–

  • -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, respectively. Both default to 1 โš–๏ธ

๐Ÿงš merge-stream

Collects profiles with associated filenames from a gcfn and gcda data stream. The stream gets read from the file you name with file, or from stdin. Then it merges those profiles with the associated profiles in the host filesystem. You can apply the optional weights while merging โœจ

For generating a gcfn and gcda data stream on the target system, check out __gcov_filename_to_gcfn() and __gcov_info_to_gcda(), which are declared in #include <gcov.h>. Iykyk ๐Ÿฆ‹

  • -v, --verbose โ€” Turns on verbose mode ๐Ÿ“ฃ
  • -w w1,w2, --weight w1,w2 โ€” Sets the merge weights for the profiles from the gcfn and gcda data stream, and for the associated profiles in the host filesystem, respectively. Both default to 1 โš–๏ธ

๐ŸŒธ rewrite

Reads the profile directory you specify and rewrites it into a new directory ๐Ÿซถ

  • -n long_long_value, --normalize <long_long_value> โ€” Normalizes the profile. The value 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 give a floating point value or a simple fraction, like 1, 2, 2/3, or 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 over all arc counters i, like this:

min (p1_counter[i] / p1_sum_all, p2_counter[i] / p2_sum_all)

Here p1_counter[i] and p2_counter[i] are two matched counters, and p1_sum_all and p2_sum_all are the sums of the 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-2026 Free Software Foundation, Inc. ๐Ÿ’–

Here's the legal stuff, and it's important, so read it carefully ๐Ÿซถ

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; with the Invariant Sections being "GNU General Public License" and "Funding Free Software", the Front-Cover texts being (a) (see below), and with the Back-Cover Texts being (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 page, bestie ๐Ÿงš This is the gcc-16 manual page, dated 2026-03-22, and it's GCOV-TOOL(1) forever ๐Ÿ’œ mwah ๐Ÿ’‹

๐Ÿ“ฆ where this page comes from