GCOV-TOOL(1)

๐ŸŽ€ gcov-tool ๐ŸŽ€

Okay bestie, welcome to the GCOV-TOOL(1) manual page (GNU, for the nerds ๐Ÿค“). Let's get into it! ๐Ÿ’…

โœจ NAME โœจ

gcov-tool is an offline gcda profile processing tool ๐Ÿงš. It works on gcc's gcda profile files without the program needing to be running. Iconic, right? ๐Ÿ˜ญ

๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

Here are all the ways you can call it. Literally every combo, no cap ๐Ÿ’€

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 for processing gcc's gcda profile files, and it is giving main character energy ๐Ÿ‘‘. Right now it can do two big things:

  • Merge two sets of profiles, with weights ๐Ÿ’œ
  • Rewrite one set of profile data. You can scale or normalize the count values ๐Ÿ“

Here's when you'd actually use this, bestie ๐Ÿซถ:

  • Say you collected profiles for different sets of inputs. You can merge them with this tool, and you can set a weight to show how important each input is to you โœจ
  • You can 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 or libgcov code, because it shares most of its code with the runtime library ๐Ÿ”ฅ
Heads up, babe: an offline merge might give you slightly different values than an online merged profile. Here's the tea on the typical differences ๐Ÿ™ˆ
  • Histogram difference: This offline tool recomputes the histogram after merging the counters, so the result is precise. Online merging can't do that. It merges two histograms together, so the result is only an approximation ๐Ÿ˜ญ
  • Summary checksum difference: The summary checksum uses a CRC32 operation. Its value depends on the link list order of the gcov-info objects. gcov-tool uses a different order than the online merge, so you'll see different summary checksums, and that's expected ๐Ÿฆ‹. It doesn't really matter though, because the compiler never uses 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 ๐ŸŒŸ

Here's everything you can pass in, grouped by vibe ๐Ÿ’–

๐ŸŽ€ Global 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. If you don't set one, it defaults to merged_profile ๐Ÿ“
  • -v, --verbose โ€” Turns on verbose mode, so you get extra info ๐Ÿ“ฃ
  • -w w1,w2, --weight w1,w2 โ€” Sets the merge weights for directory1 and directory2, in that order. Both weights default to 1 ๐Ÿซถ

๐Ÿ” rewrite

Reads the profile directory you give it and rewrites everything 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. If you don't set one, the default output name is rewrite_profile ๐ŸŒธ
  • -s float_or_simple-frac_value, --scale float_or_simple-frac_value โ€” Scales the profile counters. You can use 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 the two profile directories you specify. The score is based on the arc profiles, and it's defined as the sum of min (p1_counter[i] / p1_sum_all, p2_counter[i] / p2_sum_all) for all arc counters i. Here, p1_counter[i] and p2_counter[i] are the two matched counters, and p1_sum_all and p2_sum_all are the sums 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 a hot counter value ๐Ÿ‘‘
  • -v, --verbose โ€” Turns on verbose mode ๐Ÿ“ฃ

๐Ÿ”— SEE ALSO ๐Ÿ”—

Go check these out for more tea ๐Ÿต: 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 bestie, that's the whole page, and you're officially gcov-tool literate now ๐ŸŽ€๐Ÿ’– This version came from gcc-12, dated 2022-02-22, and I'm obsessed. Stay iconic! ๐Ÿฆ‹โœจ

๐Ÿ“ฆ where this page comes from