gcov & total executable loc

p.steiner@icoserve.com p.steiner@icoserve.com
Mon Sep 6 07:53:00 GMT 2004


hello,

because neither google nor the mailing list archives yielded any results 
on my question i hope to find help with the local gurus around...

how does gcov calculate the total executable lines?

when run on a file it outputs total stats in the scheme of:
> gcov file.cpp
95.00% of 125 source lines executed in file ....

at my company we are running multiple regression tests against a single 
library, and somehow gcov gives me a different total sloc each time. (that 
is, in the example 125 source lines total, might be 15 source lines total 
for another test, although we are talking about the same source file.)

each test might use different parts of the library (they cover different 
areas in the source), but i thought it to always calculate the same total 
figures for each source file. i can merge the line-counts to get the total 
coverage of the library tests, but i have no idea how to merge/get total 
logical lines of code in the library to be able to calculate:

covered logical sloc / total logical sloc = coverage

does gcov already hand me this information and i am just too stupid to 
see? or might there be some arcane gcc tricks for calculating the total 
executable lines of a source file?

thanks for any help!

-- peter steiner.



More information about the Gcc-help mailing list