GCOV-TOOL(1)

๐Ÿ“ฆ
version 14-20240412 ยท 4 versions
, in ubuntu noble

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 is merged_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. It reads the stream from the file specified by file or from stdin, 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 to 1 ๐Ÿ’–
  • 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, like 1, 2, 2/3, and 5/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 counter i, where 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 ๐Ÿฆ‹
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 (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