in reply to Re^2: profiling an XS module
in thread profiling an XS module

Valgrind (using the memcheck tool) is also a great way to detect memory leaks and other access errors in your XS code. I use it all the time. Highly recommended.