473,396 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

profiling a C++ python extension

I have used gprof to profile stand alone C++ programs. I am also
aware of pure python profilers. However, is there a way to get
profile information on my C++ functions when they are compiled in a
shared library (python extension module) and called from python. From
what I can tell, gmon.out will not be generated unless the entire
executable (python interpreter) was compiled with -pg. Is my only
solution to recompile the python interpreter with -pg so that my
extension module (also compiled with -pg) produces a gmon.out?

Any suggestions or tips would be helpful.

Matt

Jul 11 '07 #1
2 1564
Hi!
It doesn't suffice to compile the python interpreter with -pg, as the
module is loaded via dlopen.
I solved the problem for my case compiling an executable with embedded
python and the module itself.
I would wish, that there would be an easier way.
Best regards,
Michael

Jul 12 '07 #2
rasmus <ma*********@gmail.comwrote:
I have used gprof to profile stand alone C++ programs. I am also
aware of pure python profilers. However, is there a way to get
profile information on my C++ functions when they are compiled in a
shared library (python extension module) and called from python.
Any suggestions or tips would be helpful.
You didn't say what platform you're using. If you're using linux and
have root access, oprofile should be able to do what you need.

-M-

Jul 12 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: KefX | last post by:
Hey...as for what I'm doing with Python, look at my post "Strange Hotshot problem". To make a long story short, I'm embedding Python in order to write a plugin to a freeware music program; the...
4
by: Logan | last post by:
Several people asked me for the following HOWTO, so I decided to post it here (though it is still very 'alpha' and might contain many (?) mistakes; didn't test what I wrote, but wrote it - more or...
2
by: Irmen de Jong | last post by:
Hello I haven't received any responses on my original posting, and it could very well be that it never made it to the newsgroup (because I can't find it back on my news server here). So I'm...
6
by: cournape | last post by:
Hi there, I have some scientific application written in python. There is a good deal of list processing, but also some "simple" computation such as basic linear algebra involved. I would like to...
1
by: Dave | last post by:
Hello All, I'm trying to profile a Python program using gprof, but I don't understand some of the results, especially what some of the functions do. For example, _moncount, mcount,...
13
by: Jens Theisen | last post by:
Hello, I want to apologise in advance for this being off topic. It's not neither A C nor a C++ question, but to profiling in general, though I my chances are best to find the answer in the C/C++...
2
by: Andreas Røsdal | last post by:
Hi, I'm using the Python profiler to optimize a pathfinding algorithm of a game, and would like some help from someone who knows how to improve the performance of Python code. The algorithm is...
0
by: John Ling | last post by:
Hello, I have been trying to install an application which requires Python: http://chip.dfci.harvard.edu/~wli/MAT/ My environment is AIX 5.2. Below is the section of the setup that has failed,...
1
by: Petr Prikryl | last post by:
Do you think that the following could became PEP (pre PEP). Please, read it, comment it, reformulate it,... Abstract Introduction of the mechanism for language extensions via modules...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.