How to Enable or configure ftrace module

2019-07-29 02:33发布

问题:

i'd like to use the advanced features of ftrace but i dit not figure out how. debugfs is mounted but there is no "tracing"-folder in /sys/kernel/debug. i am running a ARM-Target @ Angstrom distro build via yocto, please see :

Image: uname -a & lsb_release -a output

zcat /proc/config.gz | grep TRACER|FTRACE output

How to configure the kernel ? which options i have to set?

回答1:

Add below kernel config options in your yocto project conf/local.conf file & then clean & rebuild linux kernel.

KERNEL_CONFIG_DYNAMIC_FTRACE="y"
KERNEL_CONFIG_DEBUG_FS="y"
KERNEL_CONFIG_FTRACE="y"
KERNEL_CONFIG_FUNCTION_TRACER="y"
KERNEL_CONFIG_FUNCTION_GRAPH_TRACER="y"
KERNEL_CONFIG_IRQSOFF_TRACER="y"
KERNEL_CONFIG_PREEMPT_TRACER="y"
KERNEL_CONFIG_SCHED_TRACER="y"
KERNEL_CONFIG_STACK_TRACER="y"
KERNEL_CONFIG_BLK_DEV_IO_TRACE="y"
KERNEL_CONFIG_FUNCTION_PROFILER="y"
KERNEL_CONFIG_FTRACE_MCOUNT_RECORD="y"

Booting with this kernel shall have ftrace enabled