0

Is there a way to run linux's prof in a way equivalent to what a program with -gprof would do? I know wouldn't be exact, but only statistically correct.

I'm basically looking for a way to do a gprof-like analysis on a C/C++ program that includes debug symbols, but without recompiling it.

viraptor
  • 33,322
  • 10
  • 107
  • 191
  • @edA-qa mort-ora-y: Which tool? I'm not aware of any stack analysing one apart from callgrind... but that's not it really. – viraptor May 02 '11 at 10:07
  • 1
    Use callgrind (or cachegrind) and then use kcachegrind for visualization (on the output file from valgrind). It has per-function analysis. I'm very happy with the data it provides. http://kcachegrind.sourceforge.net/html/Home.html – edA-qa mort-ora-y May 02 '11 at 11:35
  • [Statistically correct?](http://stackoverflow.com/questions/5028198/inaccuracy-in-gprof-output) – Mike Dunlavey May 02 '11 at 12:32

1 Answers1

1

I'm very satisfied lately by CPU profiler of the Google performance tools. Programs basically run at undistorted normal speed under it. No recompilation is required, linking against a special libraries is recommended but using LD_PRELOAD is also possible in most cases.

Peter G.
  • 14,786
  • 7
  • 57
  • 75