Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make lcov perform faster?

Tags:

c++

gcc

lcov

gcov

I'm having performance issues with lcov.

I'm executing a program in seven different profiles, collecting the coverage for each of them and then merging the coverage profile with lcov:

lcov --rc lcov_branch_coverage=1 -a coverage_1.dat -a coverage_2.dat -a coverage_3.dat -a coverage_4.dat -a coverage_5.dat -a coverage_6.dat -a coverage_7.dat -o coverage_full.dat

However, this is excruciatingly slow. It takes about 10 minutes to combine my 7 profiles, this is actually longer than it takes to compile and run the 7 profiles. Each dat file is about 1M lines.

The lcov --combine and lcov --remove steps are very slow as well. Around 45 seconds for each of them.

Is there any way to speedup this combine step ? I can use several threads if necessary and I have got plenty of memory. If there are other tool that are able to do this combination correctly, I'd be interest as well (I've tried to convert the files to Cobertura and do the merge with a Python script I found, but it crashes).

If there is an alternative to lcov completely, I'm also interested. I've been using gcovr, but with it, I have to use several other tools to do the combination and it is not optimal, but it is much faster.

like image 313
Baptiste Wicht Avatar asked May 13 '16 13:05

Baptiste Wicht


People also ask

What is difference between gcov and LCOV?

Lcov is a graphical front-end for gcov. It collects gcov data for multiple source files and creates HTML pages containing the source code annotated with coverage information. It also adds overview pages for easy navigation within the file structure. Lcov supports statement, function, and branch coverage measurement.

What is an LCOV report?

LCOV is a graphical tool for GCC's coverage testing with gcov. It creates HTML pages containing the source code annotated with coverage information by collecting gcov data from multiple source files. LCOV supports “Lines coverage” and “Functions coverage” measurement.


1 Answers

If there is an alternative to lcov completely, I'm also interested.

Try fastcov - it will use all available cores in parallel (it can output the report in lcov info format):

https://github.com/RPGillespie6/fastcov

It can also combine files. Note: You need GCC 9+

like image 162
Gillespie Avatar answered Oct 10 '22 17:10

Gillespie