|
From: Josef W. <Jos...@gm...> - 2006-08-05 22:37:22
|
On Saturday 05 August 2006 13:52, Bryan Meredith wrote: > COVERGRIND FILES START > 0:/home/bryan/covergrind/coregrind/m_trampoline.S > 1:/home/bryan/c++/qt-x11-opensource-src-4.1.4/examples/widgets/analogclock/../../../include/QtCore/../../src/corelib/global/qglobal.h > 2:/home/bryan/c++/qt-x11-opensource-src-4.1.4/examples/widgets/analogclock/../../../include/QtCore/../../src/corelib/thread/qatomic.h > . > 0:155-155 It actually would be very simple to change this to convert this to cachegrinds/callgrind format. Callgrinds format has an extension to exactly provide your file/ID number mapping. And you can load multiple files to get merging done. However, instead of a range you currently have to add every touched line seperatly (actually, KCachegrinds parser and data model knows about ranges, but can not visualize them). You would use an event type like "lineTouched", and give a 1 for every line touched in execution: events: lineTouched fl=(0) /home/bryan/covergrind/coregrind/m_trampoline.S fl=(1) /.../qglobal.h fl=(2) /.../qatomic.h ... fn=Unknown fl=(0) 155 1 161 1 ... fl=(1) 754 1 ... However: if you stripped the cache simulator from cachegrind (ie. only do instruction fetches), wouldn't this more or less exactly do what covergrind is doing now? > > If > > you run a program multiple times, are the coverage results merged? > > In the interests of keeping things simple (and hence lightweight and > fast) merging of results would be done by the GUI (long way of saying No). At least I plan to write a command line merge tool for Callgrinds (and thus, also Cachegrinds) format; so this would be another advantage to output this format. > > Also, does it give percentage coverage? > > Again, in the GUI, with both the source file and line coverage > information available, it will be simpler to generate any required > metrics (another long way of saying No). Hmmm... Then your GUI has to read debug info yourself. Otherwise you have no way to see whether a non-executed line influences the cover percentage: it could be actual code or not. If you want to try parsing the code, keep in mind that this is not only about empty lines or comments (also for Fortran, ADA, GAS ...), but also about dead code via #ifdefs). Another metric a coverage tool should provide is branch/path coverage. That is possible, but not easy either. Josef |