I have python code with C libraries, I use SWIG to plug it all together. I would like to profile the C libraries.
I compiled them with -pg
but no profiling output is generated... Is there method to profile such a mixed code?
You can use Valgrind with the Callgrind module (built-in). This will produce a file that can be displayed in KCacheGrind, which is avaliable on most Linux distributions.
To limit profiling to just your code, use the limiting collection options, this will allow Python to run at almost full speed, and only profile your code (which will run about 10x slower).
Note: I haven't tried this with Python myself, but it has worked for similar situations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With