Linux – Performance Profiling Techniques for C++ and C

c++linuxperformanceunix

What are the best tools for profiling C/C++ applications on *nix?

(I'm hoping to profile a server that is a mix of (blocking) file IO, epoll for network and fork()/execv() for some heavy lifting; but general help and more general tools are all also appreciated.)

Can you get the big system picture of RAM, CPU, network and disk all in one overview, and drill into it?

There's been a lot of talk on the kernel lists about things like perf timechart, but I haven't found anything turning up in Ubuntu yet.

Best Answer

I recommend taking stackshots, for which pstack is useful. Here's some more information:

  1. Comments on gprof.

  2. How stackshots work.

  3. A blow-by-blow example.

  4. A very short explanation.

If you want to spend money, Zoom looks like a pretty good tool.

Related Question