• Home
  • Raw
  • Download

Lines Matching +full:merge +full:- +full:multiple

2 Source-based Code Coverage
11 This document explains how to use clang's source-based code coverage feature.
12 It's called "source-based" because it operates on AST and preprocessor
17 * :doc:`SanitizerCoverage` - A low-overhead tool meant for use alongside the
18 various sanitizers. It can provide up to edge-level coverage.
20 * gcov - A GCC-compatible coverage implementation which operates on DebugInfo.
22 From this point onwards "code coverage" will refer to the source-based kind.
35 The next few sections work through a complete, copy-'n-paste friendly example
38 .. code-block:: cpp
55 To compile code with coverage enabled, pass ``-fprofile-instr-generate
56 -fcoverage-mapping`` to the compiler:
58 .. code-block:: console
61 % clang++ -fprofile-instr-generate -fcoverage-mapping foo.cc -o foo
73 ``LLVM_PROFILE_FILE`` contains a path to a non-existent directory, the missing
83 on-line profile merging. The runtime takes care of selecting a raw profile
86 be between 1 and 9. The merge pool specifier can only occur once per filename
89 .. code-block:: console
98 coverage reports. This is done using the "merge" tool in ``llvm-profdata``, so
101 .. code-block:: console
104 % llvm-profdata merge -sparse foo.profraw -o foo.profdata
106 There are multiple different ways to render coverage reports. One option is to
107 generate a line-oriented report:
109 .. code-block:: console
111 # Step 3(b): Create a line-oriented coverage report.
112 % llvm-cov show ./foo -instr-profile=foo.profdata
116 .. code-block:: console
118 % llvm-cov show ./foo -instr-profile=foo.profdata | c++filt -n
120 This report includes a summary view as well as dedicated sub-views for
123 ``-show-line-counts-or-regions`` is enabled, ``llvm-cov`` displays sub-line
126 .. code-block:: none
134 ------------------
140 ------------------
146 ------------------
148 It's possible to generate a file-level summary of coverage statistics (instead
149 of a line-oriented report) with:
151 .. code-block:: console
154 % llvm-cov report ./foo -instr-profile=foo.profdata
156 -----------------------------------------------------------------------
158 -----------------------------------------------------------------------
163 * The ``-sparse`` flag is optional but can result in dramatically smaller
168 profile runtime library allows an instrumented program to merge profiling
172 * The ``llvm-profdata`` tool can be used to merge together multiple raw or
173 indexed profiles. To combine profiling data from multiple runs of a program,
176 .. code-block:: console
178 % llvm-profdata merge -sparse foo1.profraw foo2.profdata -o foo3.profdata
189 These formats are not forwards-compatible: i.e, a tool which uses format
194 with these formats. These formats are not forwards-compatible.
208 * Forward-declare ``void __llvm_profile_initialize_file(void)`` and call it
216 * Forward-declare ``int __llvm_profile_write_file(void)`` and call it to write
217 out a profile. This function returns 0 when it succeeds, and a non-zero value
218 otherwise. Calling this function multiple times appends profile data to an
219 existing on-disk raw profile.
228 .. code-block:: cpp