User forums > General (but related to Code::Blocks)
Gcov
ewww:
Hi, this has been a while ago, is there any update to the plug in?
I need to carry out a simple task to find out the percentage of code lines executed on each run. That takes quite some time to do manually, especially with multiple small projects and files. Furthermore, I faced a problem that, it seems, one must run the program from the same path as it was compiled in? (the project directory) Else the run trace is not generated.
E.g. run trace for main executable is generated, but not for the dll's it is loading, because those have been copied from their output dir and the exe wasn't.
I also attach a very primitive cb script, that tries to do the job, but is not very good at it :)
ewww:
Let me share the changes I have made to the plugin. Attached is src and a binary, compiled with 1.12.0 sdk, so it should run with any dbg branch nightly.
Things new and fixed:
* Looking for a .gcov file in the base project directory, not in the same as corresponding src file. This makes projects with source code directory hierarchy work properly.
* wxTextFile was not able to open even slightly larger .gcov files, reading in a different way.
* The plugin does not print gcov output directly to cb log window. Instead it displays some more useful statistics per project basis, e.g.:
Gcov summary: 8 files analyzed
File1.CPP : 41 of 73 lines executed (56.2%)
File2.cpp : 487 of 786 lines executed (62.0%)
File3.cpp : 307 of 473 lines executed (64.9%)
File4.cpp : 1515 of 3120 lines executed (48.6%)
File5.cpp : 938 of 2664 lines executed (35.2%)
File6.cpp : 25 of 27 lines executed (92.6%)
File7.cpp : 61 of 64 lines executed (95.3%)
main.cpp : 88 of 89 lines executed (98.9%)
Total 3462 of 7296 lines executed (47.5%)
ewww:
Update
* Added menu item to run gcov on all projects in a workspace
* The previous version was using internal cbGcov parser to provide per file executed/total lines stats. That apparently is imprecise and may differ a lot from what gcov prints. Now the plugin is capturing the gcov process output instead.
* Parallel processing. Uses same setting as parallel compiler in the standard cb settings dialog. This gives only a minor improvement, since gcov is limited by I/O, not cpu load. E.g. on a 2 core machine i have got best results by setting process count to 16. Results may vary depending on number of cores and max count of files per project.
Still I've got a couple of related questions.
First, I am using cb in command line mode to build my workspace. I would find it very useful to run coverage the same way. Is it possible to invoke a non-compiler plugin from command line?
Also, if anyone has got a good idea how to display the more detailed statistics in cb editor windows, you are welcome to share the knowledge :) More specifically I am talking about branch and call stats. Adding those next to line call count isn't that pretty at all, dont you think?
killerbot:
I once issued as a post build step of my project/target the launching of a plug-in (Cppcheck plug-in).
It worked, but there some issues with the active project. Should retrieve my old laptop from underneath its pile of dust, and check how I did it...
Will try to do so this evening ;-)
ewww:
Hmmmm... Post-build will not do in this case. You have to run the target first, potentially multiple times, to generate the coverage data first. I can always make a stand alone binary which is parsing a full compiler command line output to perform this step, but still running all from within cb would be a more integrated solution ;)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version