Reputation: 1208
I want to do profiling on a C++ executable which uses a shared library. gprof can't profile the functions in the shared library and I don't have sprof. Is there a way to copy all functions from the shared library to the executable and run it with gprof. I can make change in the make file but the shared library is a 3rd party library hence the functions need to copied.
Edit I want to find the time my program spends in each functions and the code contains nested functions hence a simple wrapper won't suffice.
Upvotes: 0
Views: 92
Reputation: 28892
You can use valgrind for profiling. This does not require special builds.
Edit: Valgrind is a process execution emulator that runs your process in its internal enviroment effectively interpreting each opcode, since the process is not running bare-metal valgrind is able to record what is going on internally. Callgrind (one of valgrinds command states) will record the time spent in each function so is ideal for profiling.
Upvotes: 2