foss-for-synopsys-dwc-arc-processors / linux

Helpful resources for users & developers of Linux kernel for ARC
22 stars 13 forks source link

ARCv3: Implemented ftrace #146

Closed BrunoASMauricio closed 7 months ago

BrunoASMauricio commented 9 months ago

As part of the request in https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/144, implemented both CONFIG_FTRACE (function entry tracing) and CONFIG_FUNCTION_GRAPH_TRACER (function entry and exit tracing) for ARCv3.

To use this feature, we need to first enable it in menuconfig (activate the FTRACE and FUNCTION_GRAPH_TRACER options)

Then, we mount the debugfs filesystem:

mount -t tracefs nodev /sys/kernel/tracing

Select the tracer we want. For full tracing we have:

echo function_graph > /sys/kernel/tracing/current_tracer

And for entry only tracing we have:

echo function > /sys/kernel/tracing/current_tracer

Then to see the trace, read from the '/sys/kernel/tracing/trace' file

less /sys/kernel/tracing/trace