GCOV-TOOL(1)
GCOV-TOOL(1) ๐ okay bestie, this is the manual page for gcov-tool from GNU, and it's a whole vibe ๐
โจ NAME โจ
gcov-tool - offline gcda profile processing tool ๐ฆ
๐ธ SYNOPSIS ๐ธ
Here's how you call it, bestie:
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, and it is literally that and nothing else ๐
rn 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 ๐ฅ
Use cases? Iconic, honestly:
- Collect profiles for different sets of inputs, then merge them together. You can give each one a weight to show how important it is ๐
- Collect profiles from target systems without a filesystem (freestanding environments). Then merge those with the matching profiles on the host system. Weights work here too ๐ง
- 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 ๐
ngl, an offline merge might come out with slightly different values than the online merged profile. Here are the typical differences, bestie ๐ซถ
- histogram difference: This offline tool recomputes the histogram after merging the counters, so the resulting histogram is precise. The online merge doesn't have this ability. Its histogram gets 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. 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 runtime stuff, like heap addresses. So it's totally normal to see differences 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 ismerged_profile๐-v,--verboseโ Turns on verbose mode ๐ฃ-w w1,w2,--weight w1,w2โ Sets the merge weights for directory1 and directory2, respectively. Both default to1๐
merge-streamโ Collects profiles with associated filenames from a gcfn and gcda data stream. It reads the stream from the file specified by file or fromstdin, then merges the 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 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 for the profiles from the gcfn and gcda data stream and for the associated profiles in the host filesystem, respectively. Both default to1๐
- For generating a gcfn and gcda data stream on the target system, check out the "
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, like1,2,2/3, and5/3โจ-v,--verboseโ Turns on verbose mode ๐ฃ
overlapโ Computes the overlap score between two specified profile directories. The score is based on the arc profiles, and it's defined as the sum of the following, for all arc counteri, wherep1_counter[i]andp2_counter[i]are two matched counters, andp1_sum_allandp2_sum_allare the sums of counter values in profile 1 and profile 2, respectively ๐ฆ
min (p1_counter[i] / p1_sum_all, p2_counter[i] / p2_sum_all)
-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. Go check them out, bestie ๐
๐ COPYRIGHT ๐
Copyright (c) 2014-2024 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 came from gcc-14 and is dated 2024-04-12, so go forth and profile responsibly ๐ซถ๐ธโจ
๐ฆ where this page comes from
- ubuntu noble: gcc-14-powerpc64-linux-gnu 14-20240412-0ubuntu1cross1
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms