98bd83a8fc
* Use common_compile_options(turbo-cov) to fix RTTI linker errors on macOS + debug builds. * Delete the .profraw files after they've been consumed. * Include the test-case parameters in the coverage information Change-Id: I02c6f408ed6e65c6f7e9eb1b4cd8443e4cfa7939 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117882 Kokoro: Ben Clayton <bclayton@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com> |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
README.md | ||
main.cpp |
README.md
turbo-cov
About
turbo-cov
can be used by the ./tools/run cts run-cts
tool, when passing the --coverage
flag.
turbo-cov
is substantially faster at processing coverage data than using the standard LLVM tools.
Requirements
To build turbo-cov
, you will need to set the CMake define the CMake flag LLVM_SOURCE_DIR
to the /llvm
subdirectory of a LLVM checkout. turbo-cov
requires LLVM 9+.
Details
Clang provides two tools for processing coverage data:
llvm-profdata
indexes the raw.profraw
coverage profile file and emits a.profdata
file.llvm-cov
further processes the.profdata
file into something human readable or machine parsable.
llvm-cov
provides many options, including emitting an pretty HTML file, but is remarkably slow at producing easily machine-parsable data.
Fortunately the core of llvm-cov
is a few hundreds of lines of code, as it relies on LLVM libraries to do the heavy lifting.
turbo-cov
is a a simple llvm-cov
replacement, which efficiently converts a .profdata
into a simple binary stream which can be consumed by the tools/src/cov
package.
File structure
turbo-cov
is a trivial binary stream, which takes the tightly-packed form:
struct Root {
uint32_t num_files;
File file[num_files];
};
struct File {
uint32_t name_length
uint8_t name_data[name_length];
uint32_t num_segments;
Segment segments[num_segments];
};
struct Segment {
// The line where this segment begins.
uint32_t line;
// The column where this segment begins.
uint32_t column;
// The execution count, or zero if no count was recorded.
uint32_t count;
// When 0, the segment was uninstrumented or skipped.
uint8_t hasCount;
}