Forrest logo
back to the gcov tool

gcov:tldr:20087

gcov: Write branch frequencies to the output file and print summary information to `stdout` as a percentage.
$ gcov --branch-probabilities ${filename-cpp}
try on your machine

The command "gcov --branch-probabilities ${filename-cpp}" is used to generate code coverage information using the gcov tool.

Gcov is a coverage profiling tool for GNU based compilers that enables developers to analyze which parts of their code have been tested by their test suite.

Here's a breakdown of the command:

  • "gcov" is the name of the tool that is being executed.
  • "--branch-probabilities" is an option for gcov that tells the tool to provide branch coverage information. Branch coverage measures the percentage of decision points in the code that have been executed.
  • "${filename-cpp}" represents a placeholder for the name of the C++ source file that you want to generate coverage information for. You need to replace this placeholder with the actual filename of your C++ source file.

When you run this command, gcov will analyze the specified C++ source file and generate a coverage report that includes branch probabilities. This report will show which branches in your code were taken during testing and provide information about the likelihood of each branch being executed.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the gcov tool