lcov icon indicating copy to clipboard operation
lcov copied to clipboard

Lcov process coverage report too slow with gcc9.

Open Shylock-Hg opened this issue 4 years ago • 5 comments

I try to collect coverage with lcov 40580cd65909bc8324ae09b36bca2e178652ff3f, but it process too slow unusually than the lcov before gcc9.

Shylock-Hg avatar Mar 20 '20 02:03 Shylock-Hg

lcov 1.15 with gcov-10 seems to be extremely slow compared to lcov 1.14 and gcc-6.

sdarwin avatar Jun 08 '21 19:06 sdarwin

I think it will work faster if you set geninfo_intermediate variable to 0 in lcovrc or via --rc option (maybe not, it might call gcov -i same number of times). The problem must be caused by lcov invoking gcov for each input file separately instead of batching them (which should be done carefully because of this bug).

xaizek avatar Jun 08 '21 20:06 xaizek

I think it will work faster if you set geninfo_intermediate variable to 0

AFAIU, this isn't an option with gcc9+, given the explanation of https://github.com/linux-test-project/lcov/commit/75fbae1cfc5027f818a0bb865bf6f96fab3202da:

Note: The way that the intermediate file format support is implemented
in geninfo removes the need to parse .gcno files directly. Since geninfo
does not include support for parsing GCC 9 .gcno files, using the
intermediate format is the only option for geninfo to collect coverage
data generated by GCC version 9.

Or has support for parsing GCC 9 .gcno been added in the meantime?

sfc-gh-sgiesecke avatar Jan 14 '22 09:01 sfc-gh-sgiesecke

Or has support for parsing GCC 9 .gcno been added in the meantime?

Probably not. I didn't realize gcno format isn't parsed for newer versions of GCC. Thanks for the correction.

Not sure if this is actually doable, but maybe one could invoke gcov prior to lcov and then specify custom gcov command for lcov which will just reuse that output of gcov. Might not be worth it because some processing is necessary anyway (for running gcov multiple times and for picking which files to return to not miss any). GCC 9 is the first version which adds --stdout option, so it might be easier to use it and do not deal with files at all (which is both faster and avoids bugs mentioned above).

xaizek avatar Jan 14 '22 21:01 xaizek

See also #94, a major factor for the slowness with gcc9+ seems to be the JSON parsing.

sfc-gh-sgiesecke avatar Jan 25 '22 15:01 sfc-gh-sgiesecke

Is this still an issue? Could you re-try with current TOT, possibly try the "--parallel" flag as well (see the man pages). If you are more-or-less happy at that point: please close this issue. If not happy: please include some statistics - and hopefully a testcase - so we can see if anything can be done to go faster. Thanks Henry

henry2cox avatar Jan 06 '23 15:01 henry2cox