[Numpy-discussion] C code coverage tool
Michael Droettboom
mdroe at stsci.edu
Tue Oct 27 07:33:54 EDT 2009
On 10/27/2009 05:11 AM, Pauli Virtanen wrote:
> Mon, 26 Oct 2009 14:26:20 -0400, Michael Droettboom wrote:
>
>> I know David Cournapeau has done some work on using gcov for coverage
>> with Numpy.
>>
>> Unaware of this, (doh! -- I should have Googled first), I wrote a small
>> C code-coverage tool built on top of valgrind's callgrind tool, so it
>> basically only works on x86/AMD64 unixy platforms, but unlike gcov it
>> doesn't require any recompilation headaches (though compiling
>> unoptimized helps).
>>
> [clip]
>
> Where's the code?
>
It's in the Numpy SVN tree now, under tools/c_coverage
> [clip]
>
>> Is this something we want to add to the SVN tree, maybe under tools?
>>
> Yes. Also, maybe you want to send it to the Valgrind guys, too. If they
> don't yet have a code coverage functionality yet, it could be nice to
> have.
>
There has been a coverage-only valgrind tool in the works for almost two
years (vcov). That's a lot more work that what I've done here (by
reusing callgrind for the purpose), but it will apparently be more
performant. Personally, I couldn't get it to compile (I think it's out
of sync with the rest of valgrind atm).
I didn't want to wait for that, and I don't know enough about valgrind
internals to effectively contribute, so I just wrote a callgrind parser
(really not that hard). I found another project [1] that takes a
similar approach, but it's written in C++ and looked too difficult to
adapt to handle Numpy's code generation.
[1] http://github.com/icefox/callgrind_tools
Mike
More information about the NumPy-Discussion
mailing list