views:

545

answers:

1

Hi, I am working on Linux environment. I have two 'C' source packages train and test_train.

  1. train package when compiled generates libtrain.so
  2. test_train links to libtrain.so and generates executable train-test

Now I want to generate a call graph using gprof which shows calling sequence of functions in main program as well as those inside libtrain.so

I am compiling and linking both packages with -pg option and debugging level is o0. After I do ./train-test , gmon.out is generated. Then I do:

$ gprof -q ./train-test gmon.out

Here, output shows call graph of functions in train-test but not in libtrain.so

What could be the problem ?

+1  A: 

Do you just want a call graph? Or are you trying to find performance problems? If the latter, consider this link.

Mike Dunlavey
yes I am looking for performance analysis.Actually i want to test how much time each function in the library takes ...
atv
@atv: Ok, but timing routines and locating performance problems that you can fix are two different goals. Timing routines gives you very poor information about where your problems are, while stack samples give you poor timing information, but very good information about where performance problems are in your code. This may be not what you expect, but it's absolutely true.
Mike Dunlavey