GCOV-TOOL(1)

โœจ NAME โœจ

okay bestie, meet gcov-tool ๐Ÿ’– It's an offline gcda profile processing tool that works on gcc's gcda profile files ๐Ÿงš

๐ŸŒธ SYNOPSIS ๐ŸŒธ

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 ๐Ÿฆ‹

okay so gcov-tool is literally the offline tool for processing gcc's gcda profile files, and it's giving main character energy ๐Ÿ‘‘

Right now it can do two things:

  • merge two sets of profiles, with weights ๐Ÿ’…
  • rewrite one set of profile contents. You can scale the count values or normalize them ๐ŸŽ€

The use cases are lowkey iconic:

  • Collect profiles from different sets of inputs and merge them together. You can set a weight to show how much each input matters ๐ŸŒˆ
  • Rewrite a profile after removing some of the gcda files, and it keeps the summary and the 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 give you slightly different values than the online merged profile. These are the typical differences:
  • histogram difference ๐Ÿ“Š: The offline tool recomputes the histogram after merging the counters, so the result is precise. The online merge can't do that. It merges two histograms into one, 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 gcov-tool uses a different order than the online merge. So different summary checksums are expected. It doesn't really matter, 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. Seeing differences in these counters is totally normal ๐Ÿซถ

โœจ OPTIONS โœจ

  • -h, --help โ€” Shows help about using 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, bestie ๐Ÿซถ

  • -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, in that order. Both default to 1 โš–๏ธ

๐ŸŒˆ rewrite ๐ŸŒˆ

Reads the profile directory you give it and rewrites it into 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 number or a simple fraction, like 1, 2, 2/3, or 5/3 ๐Ÿฆ‹
  • -v, --verbose โ€” Turns on verbose mode ๐Ÿ“ฃ

๐Ÿ”ฎ overlap ๐Ÿ”ฎ

Computes the overlap score between two profile directories you specify. The score is based on the arc profiles, and it's defined as the sum of the minimum of two ratios, across every arc counter i ๐Ÿงฎ

min (p1_counter[i] / p1_sum_all, p2_counter[i] / p2_sum_all)

In that formula, p1_counter[i] and p2_counter[i] are the 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 a 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 (c) 2014-2022 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.


okay that's the whole tea, bestie ๐Ÿซถ Source/version gcc-12, dated 2022-03-02, all for GCOV-TOOL(1) ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from