Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance profiling on Linux

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.

like image 401
Will Avatar asked Dec 09 '09 16:12

Will


People also ask

What is profiling in Linux?

Profiling is used in Linux to improve code performance by analysing call times and call chains involved in the operation. You can find out the time taken by functions (which function code took a long time to run) and this can be very useful to identify bottlenecks.

What is perf tool in Linux?

The Linux perf tool is a lightweight command-line utility for profiling and monitoring CPU performance on Linux systems. Although the tool is simple, it provides in-depth information that helps in analyzing CPUs. The command contains many subcommands for collecting, tracing, and analyzing CPU event data.

What is profiler in performance testing?

Performance profilers are software development tools designed to help you analyze the performance of your applications and improve poorly performing sections of code.


2 Answers

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.

like image 149
Mike Dunlavey Avatar answered Oct 23 '22 12:10

Mike Dunlavey


For performance, you can try Callgrind, a Valgrind tool. Here is a nice article showing it in action.

like image 36
Aurélien Gâteau Avatar answered Oct 23 '22 10:10

Aurélien Gâteau