GCOV-TOOL(1)

πŸ“¦
version 9.5.0 Β· 2 versions
, in ubuntu jammy, ubuntu noble

✨ GCOV-TOOL ✨ πŸ¦‹ (gcov-tool, offline gcda profile processing tool)

Okay bestie, let's talk about gcov-tool πŸ’… It's an offline tool for processing gcc's gcda profile files, and it is literally so good. πŸ”₯

🌸 NAME 🌸

gcov-tool - offline gcda profile processing tool πŸ’–

πŸŽ€ SYNOPSIS πŸŽ€

Here are the vibes you can call it with:

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 an offline tool that processes gcc's gcda profile files. ✨

It currently does two main things:

  • merge two sets of profiles, with weights πŸ’œ
  • read one set of profile and rewrite its contents. You can scale or normalize the count values πŸ“

Here's when you'd actually use this, bestie:

  • Collect profiles for different sets of inputs, then merge them together. You can set a weight to show how much each input matters. 🌈
  • Rewrite the profile after removing a subset of the gcda files, and it keeps the summary and histogram consistent. Iconic. πŸ‘‘
  • It can also help you debug libgcov code, because the tool shares most of its code with the runtime library. 🧚

Heads up though, because this is important 😭 When you merge offline, the profile might have slightly different values from an online merged profile. Here are the typical differences:

  • Histogram difference: The offline tool recomputes the histogram after merging the counters, so the result is precise. Online merging can't do that. It merges two histograms into one, so the result is only an approximation. πŸŽ€
  • Summary checksum difference: The summary checksum uses a CRC32 operation, and its value depends on the link list order of gcov-info objects. gcov-tool uses a different order than the online merge, so you'll see different summary checksums. Honestly it doesn't really matter, because the compiler never uses this checksum anywhere. πŸ’…
  • Value profile counter difference: Some value profile counters depend on runtime stuff, like heap addresses. Seeing differences in these counters is totally normal. 🫢

🌈 OPTIONS 🌈

  • -h, --help β€” Shows you help for using gcov-tool on standard output, then exits without doing any more processing. πŸ™ˆ
  • -v, --version β€” Shows the gcov-tool version number on standard output, then exits without doing any more processing. πŸ”₯

🧚 merge 🧚

Merges two profile directories together. πŸ’–

  • -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. ⭐

πŸ’œ rewrite πŸ’œ

Reads the specified profile directory 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, and 5/3. πŸ¦‹
  • -v, --verbose β€” Turns on verbose mode. πŸ“£

🌸 overlap 🌸

Computes the overlap score between the two specified profile directories. The overlap score is based on the arc profiles. It's defined as the sum of min (p1_counter[i] / p1_sum_all, p2_counter[i] / p2_sum_all), taken over all arc counters 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. Math bestie, I know, but it's giving precision πŸ€“πŸ’…

  • -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. Go read those if you're hungry for more, periodt. πŸ“š

Copyright (c) 2014-2019 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 bestie, that's the whole tea! ✨ This page came from gcc-9.5.0 and was dated 2022-05-27, so go forth and profile responsibly, periodt πŸŽ€πŸ’–πŸ¦‹