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-toolthan 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 usinggcov-toolon the standard output, then exits without doing any further processing πββοΈ-v,--versionβ Shows thegcov-toolversion 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 ismerged_profile.-v,--verboseβ Turns on verbose mode.-w w1,w2,--weight w1,w2β Sets the merge weights ofdirectory1anddirectory2, respectively. The default weights are1for both.
merge-streamβ Collects profiles with associated filenames from a gcfn and gcda data stream. The stream is read from the file specified byfileor fromstdin. 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 are1for 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 isrewrite_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 as1,2,2/3, and5/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 countersi:
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 π
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-arm-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