Build and Setup Instructions For Using Ftrace

For more detailed information about using Ftrace, please check out this article.

Step 1: Get these tools

  • libncurses (sudo apt-get install ncurses-dev)
    • (for make menuconfig)
  • trace-cmd (sudo apt-get install trace-cmd)
    • (for trace-cmd, a front end for the kernel's function trace file)

Step 2: Configure the Linux kernel

Make sure you have these turned on:

  • Tracers (main menu-->Kernel Hacking-->Tracers.
  • Function Tracers (main menu-->Kernel Hacking-->Tracers-->Kernel Function Tracer).
  • Function Graph Tracers (main menu-->Kernel Hacking-->Tracers-->Kernel Function Graph Tracer).
  • Stack Tracer (main menu-->Kernel Hacking-->Tracers-->Trace max stack).
  • Dynamic Tracing (main menu-->Kernel Hacking-->-->Tracers-->enable/disable function tracing dynamically).

Exit and save your configuration.

Step 3: Build and install the kernel, then reboot

In the root of the kernel source:

        make  # (use make -j8 if e.g. you have 8 cores, will go faster)
        (sudo) make modules_install install   # order is important; this updates grub
        (sudo) reboot