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()/
Compile with -pg, run the program, and then use gprof
Compiling (and linking) with -pg adds profiling code and the profiling libraries to the executable, which then produces a file called gmon.out that contains the timing information. gprof displays call graphs and their (absolute and relative) timings.
See man gprof
for details.
oprofile might interest you. Ubuntu should have all the packages you need.
Description of using -gp and gproff here http://www.ibm.com/developerworks/library/l-gnuprof.html
For performance, you can try Callgrind, a Valgrind tool. Here is a nice article showing it in action.