Menu Close

Check Configs: Check in file /boot/config-5.15.0-25-generic

If these configs are not enabled the kernel needs to be recompiled

CONFIG_FUNCTION_TRACER=y
CONFIG_FUNCTION_GRAPH_TRACER=y
CONFIG_TRACING=y

In Linux, function tracing is a mechanism provided by the ftrace framework, which allows you to trace kernel function calls and analyze their behavior. Below are the steps to enable function tracing in Linux

mount -t debugfs none /sys/kernel/debug

Trace Directory

cd /sys/kernel/debug/tracing

Function Trace

echo function > current_tracer

To trace specific functions

echo function1 > set_ftrace_filter
echo function2 >> set_ftrace_filter

To exclude specific functions

echo function_to_exclude > set_ftrace_notrace

Start Tracing

echo 1 > trace_on

Monitor TraceLog

cat trace
cat trace_pipe