Skip to main content

A massively parallel gcov wrapper for generating intermediate coverage formats fast

Project description

fastcov

A massively parallel gcov wrapper for generating intermediate coverage formats fast

The goal of fastcov is to generate code coverage intermediate formats as fast as possible, even for large projects with hundreds of gcda objects. The intermediate formats may then be consumed by a report generator such as lcov's genhtml, or a dedicated front end such as coveralls. fastcov was originally designed to be a drop-in replacement for lcov (application coverage only, not kernel coverage).

Currently the only intermediate formats supported are gcov json format, fastcov json format, and lcov info format. Adding support for other formats should require just a few lines of python to transform gcov json format to the desired shape.

In order to achieve the speed gains, a few constraints apply:

  1. GCC version >= 9.0.0

These versions of GCOV have support for JSON intermediate format as well as streaming report data straight to stdout. This second feature (the ability for gcov to stream report data to stdout) is critical - without it, fastcov cannot run multiple instances of gcov in parallel without loss of correctness.

Since GCC 9 has not officially released, the current easiest way (in my opinion) to try out fastcov is to use the fastcov docker image, which has the latest versions of the GCC 9 compilers, Python3, and CMake inside:

docker pull rpgillespie6/fastcov:latest

If you need other dependencies, just modify the Dockerfile and rebuild.

  1. Object files must be either be built:
  • Using absolute paths for all -I flags passed to the compiler

or

  • Invoking the compiler from the same root directory

If you use CMake, you are almost certainly satisfying this second constraint (unless you care about ExternalProject coverage).

Quick Start

Assuming you now have access to GCC 9, fastcov is easy to use:

(Optional - if using docker image):

$ docker run -it --rm -v ${PWD}:/work -w /work -u $(id -u ${USER}):$(id -g ${USER}) rpgillespie6/fastcov
$ <build project>

Once the project is built:

$ cd build_dir
$ fastcov.py --zerocounters
$ <run unit tests>
$ fastcov.py --exclude /usr/include --lcov -o report.info
$ genhtml -o code_coverage report.info

Note that many of the options (such as --exclude) can take a list of parameters. For example, you could do something like:

$ fastcov.py --exclude /usr/include test/ ext/ --lcov -o report.info

Check out fastcov.py --help for more features and filtering options!

Installation

A minimum of Python 3.5 is currently required.

Fastcov is a single source python tool. That means you can simply copy fastcov.py from this repository and run it directly with no other hassle.

However, fastcov is also available as a Python3 package that can be installed via pip3.

Install newest stable fastcov release from PyPI:

$ pip3 install fastcov

Install development version from GitHub:

$ pip3 install git+https://github.com/rpgillespie6/fastcov.git

Benchmarks

Anecdotal testing on my own projects indicate that fastcov is over 100x faster than lcov and over 30x faster than gcovr:

Project Size: ~250 .gcda, ~500 .gcov generated by gcov

Time to process all gcda and parse all gcov:

  • fastcov: ~700ms
  • lcov: ~90s
  • gcovr: ~30s

Your mileage may vary depending on the number of cores you have available for fastcov to use!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastcov-1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file fastcov-1.0-py3-none-any.whl.

File metadata

  • Download URL: fastcov-1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for fastcov-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9e3debd9f1268cb38f12c14710405f9e907d82d9ceec61229d089fadead3e68
MD5 8470a12a1f9e83a8378a75adef5f0957
BLAKE2b-256 9730d05d0974346ecff763b265f38d6b126c8f4f7d7bfdc0c9883513a81fbc84

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page