GCOV-TOOL(1)
π 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 usinggcov-toolon standard output, then exits without doing any further processing π.-v,--versionβ Shows thegcov-toolversion 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 ismerged_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 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. You can pass a floating point value or a simple fraction, like1,2,2/3, and5/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 π
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 π§β¨π
π¦ where this page comes from
- ubuntu noble: gcc-11-mips-linux-gnu 11.5.0-1ubuntu1~24.04cross1
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms