Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to profile program on Linux platform without rebuilding?

I've used two profiling tools (VTune on windows and dbx (within sunstudio) on Solaris) which can profile program without rebuild them, and during profiling, the program just run at the same speed as normal. Both of these 2 features saved me a lot of time.

Now I want to know if there is some free tools available on Linux platform can do the same thing. I think I need profiling tools based on sampling. VTune is good but expensive ... I've heard of gprof and valgrind. But seems gprof need instrument the program (so we have to rebuild the program) and valgrind will slow down the program execution quite a lot. (from valgrind's introduction, Cachegrind runs programs about 20--100x slower than normal, and Callgrind which I need to profiling is based on Cachegrind)

For profiling, I just need to figure out the execution time of function calls so I can find out where the performance degradation happens. Actually I don't need many low level profiling information as Cachegrind provided...

like image 949
superb Avatar asked Mar 05 '10 02:03

superb


3 Answers

oprofile is pretty good, but it can be difficult to set up. It also doesn't require you to rebuild your program.

like image 175
George Avatar answered Nov 15 '22 03:11

George


Agreeing with Paul, I think Zoom is probably the best Linux profiler you can pay for.

However, for real results, I rely on this simple method, that I've been using since before profilers were invented.

like image 43
Mike Dunlavey Avatar answered Nov 15 '22 02:11

Mike Dunlavey


Performance Counters for Linux is a new tool usable on kernels 2.6.31 and later; it's less intrusive (to both the program and the system as a whole) than valgrind or OProfile.

like image 22
ephemient Avatar answered Nov 15 '22 03:11

ephemient