GCOV-TOOL(1)
๐ 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 tomerged_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 isrewrite_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, like1,2,2/3, or5/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 โจ
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
- ubuntu resolute: gcc-16-hppa-linux-gnu 16-20260322-1ubuntu1cross1
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms