I want to trace specific function with ftrace, but with all further calls from that function.
I've managed to start ftrace with filter on my desired function, but now it only shows me this one specific function called.
So my question is: How to print all functions called from specific function, functions called by those functions, and so on?
You can also set the max_graph_depth and get more depth of your function graph.
Following steps will help in generating function graph of selected linux function.
1. cd /sys/kernel/debug/tracing
2. cat /dev/null > trace
3. echo generic_make_request > set_graph_function
4. echo 10 > max_graph_depth
5. echo function_graph > current_tracer
6. echo 1 > tracing_on
7. dd if=/dev/sddk of=~/test bs=512 count=5
8. cp trace ~/dd_trace_depth10
9. echo 0 > tracing_on
10. echo > set_graph_function
11. echo 0 > max_graph_depth
12. cat /dev/null > trace
Enable Tracing: In this example I have selected the filter function as "generic_make_request". As such the step 3 sets the graph function to "generic_make_request" linux function. Then we have set the graph depth to 10 in step 4. Step 5 sets the current tracer as "function_graph". After all these are set we enable the tracing.
Action: Now we perform action for which we wanted a linux trace. In this example we perform an I/O with dd command. This command will hit the generic_make_request function and the file /sys/kernel/debug/tracing/trace will be filled with the function graph.
Disable Tracing: Steps 9, 10, 11 will disable the tracing
Refer : http://sklinuxblog.blogspot.com/2014/12/generating-function-graph-in-linux.html
I was able to resolve the problem. Here's the solution with kmalloc as example.
cd /sys/kernel/debug/tracing
echo kmalloc > set_graph_function
echo function_graph > current_tracer
cat trace
Be sure to reset all filters (like set_ftrace_filter) before using function_graph.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With