Summary
Nobody can complain that Linux lacks options for profiling and tracing. This chapter has given you an overview of some of the most common ones.
When faced with a system that is not performing as well as you would like, start with top
and try to identify the problem. If it proves to be a single application, then you can use perf record
/report
to profile it, bearing in mind that you will have to configure the kernel to enable perf
and you will need debug symbols for the binaries and kernel. If the problem is not so well localized, use perf
or BCC tools to get a system-wide view.
Ftrace comes into its own when you have specific questions about the behavior of the kernel. The function
and function_graph
tracers provide a detailed view of the relationship and sequence of function calls. The event tracers allow you to extract more information about functions, including the parameters and return values. LTTng performs a similar role, making use of the event trace mechanism,...