Nobody can complain that Linux lacks options to profile and trace. 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. OProfile is an alternative to perf record
and can tell you similar things. gprof
is, frankly, outdated but it does have the advantage of not requiring kernel support. If the problem is not so well localized, use perf
(or OProfile) 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 give a detailed view of the relationship and sequence of function calls. The event tracers allow you to extract more...