GCOV-TOOL(1)

πŸŽ€ gcov-tool πŸŽ€

Hiii bestie, this is the GCOV-TOOL(1) manual page from the GNU crew, and it's giving gcc energy πŸ¦‹βœ¨

✨ NAME ✨

gcov-tool is an offline gcda profile processing tool πŸ’… It works on gcc's gcda profile files, so you can process your data without needing a runtime.

🫢 SYNOPSIS 🫢

Here are all the ways you can call it, copy-paste ready:

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 🌸

okay so gcov-tool is an offline tool for processing gcc's gcda profile files 🧚

Current gcov-tool is literally able to 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 giving main character energy:

  • Collect profiles for different sets of inputs and merge them together. You can specify the weight to factor in the relative importance of each input. πŸ‘‘
  • Collect profiles from target systems without a filesystem (freestanding environments). Then merge those collected profiles with the associated profiles on the host system. You can specify the weight to factor in the relative importance of each input. 🌈
  • Rewrite the profile after removing a subset of the gcda files, while keeping the summary and histogram consistent. πŸ“
  • It can also be used to debug libgcov code, since the tool shares most of its code with the runtime library. πŸ™ˆ
Heads up, bestie! For the merging operation, a profile generated offline may contain slightly different values from 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 merging doesn't have this capability. Its histogram is merged from two histograms, 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 it's expected to have 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 counter values are runtime dependent, like heap addresses. It's totally normal to see some difference in these kinds of counters πŸ¦‹

πŸ‘‘ OPTIONS πŸ‘‘

  • -h, --help β€” Shows help about using gcov-tool on the standard output, then exits without doing any further processing πŸ™‹β€β™€οΈ
  • -v, --version β€” Shows the gcov-tool version number on the 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.
  • merge-stream β€” Collects profiles with associated filenames from a gcfn and gcda data stream. The stream is read from the file specified by file or from stdin. Then the profiles are merged with the associated profiles in the host filesystem, and the optional weights are applied while merging 🌊

For generating a gcfn and gcda data stream on the target system, check out the __gcov_filename_to_gcfn() and __gcov_info_to_gcda() functions declared in #include <gcov.h> 🧚

  • -v, --verbose β€” Turns on verbose mode.
  • -w w1,w2, --weight w1,w2 β€” Sets the merge weights of the profiles from the gcfn and gcda data stream, and of the associated profiles in the host filesystem, 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. The value can be a floating point value or a simple fraction, such as 1, 2, 2/3, and 5/3 πŸ“
    • -v, --verbose β€” Turns on verbose mode.
  • overlap β€” Computes the overlap score between the two specified profile directories πŸ¦‹ The score is based on the arc profiles, and it's defined as the sum of min over all arc counters i:
sum of min (p1_counter[i] / p1_sum_all, p2_counter[i] / p2_sum_all), for all arc counter i

Here, p1_counter[i] and p2_counter[i] are 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 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. 🫢

The FSF says you're totally allowed to copy, distribute and/or modify this document under 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.

Okay bestie, that's the whole page πŸ’– It's from gcc-16, dated 2026-08-19, and it's the GCOV-TOOL(1) page. Now go profile something iconic πŸŽ€βœ¨

πŸ“¦ where this page comes from
  • fedora 44: gcc-powerpc64-linux-gnu 16.2.1-1.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl
  • πŸ’– girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms