开发者

How to profile program on Linux platform without rebuilding?

开发者 https://www.devze.com 2022-12-21 20:12 出处:网络
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

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 n开发者_如何学JAVAeed 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...


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


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.


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.


A nicer option than oprofile is Zoom. It's similar to Shark on Mac OS X, if you have ever used that. It's commercial ($199) but you can get a free trial from www.rotateright.com.

0

精彩评论

暂无评论...
验证码 换一张
取 消