What is ftrace in linux?

What is ftrace in linux?

Ftrace is a tracing framework for the Linux kernel. Ftrace stands for function tracer and basically lets you watch and record the execution flow of kernel functions. It was created by Steven Rostedt, derived from two other tools called latency tracer from Ingo Molnar and Steven’s logdev utility.

What is function tracing?

Xdebug allows you to log all function calls, including parameters and return values to a file in different formats. Those so-called “function traces” can be a help for when you are new to an application or when you are trying to figure out what exactly is going on when your application is running.

What are the benefits of using ftrace in Linux?

Many distributions already have various configurations of Ftrace enabled in their most recent releases. One of the benefits that Ftrace brings to Linux is the ability to see what is happening inside the kernel. As such, this makes finding problem areas or simply tracking down that strange bug more manageable.

Where did the idea for ftrace come from?

Ftrace was derived from two tools. One was the “latency tracer” by Ingo Molnar used in the -rt tree. The other was my own “logdev” utility that had its primary use on debugging the Linux kernel. This article will mostly describe features that came out of logdev, but will also look at the function tracer that originated in the latency tracer.

What to look for in the header for ftrace?

The header explains the format of the output pretty well. The first two items are the traced task name and PID. The CPU that the trace was executed on is within the brackets. The timestamp is the time since boot, followed by the function name. The function in this case is the function being traced with its parent following the ” <- ” symbol.

How to debug the kernel using ftrace Part 1?

For the purpose of debugging, the kernel configuration parameters that should be enabled are: One of the most powerful tracers of Ftrace is the function tracer. It uses the -pg option of gcc to have every function in the kernel call a special function ” mcount () “.