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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.