enable_function_graph is very expensive as you found out.
THere is no native way to filter it to a process. THe best you can do is to use function_filters or function_graph_roots to limit the funcgrph to some known functions.
I would really recommend to use long-tracing mode, like this
duration_ms: 20000
write_into_file: true
file_write_period_ms: 1000
This will read the buffers every 1s and write the contents into the file. Should allow you to get 20s of data.
The other thing you can do is to put the funcgraph in another buffer, by doing something like this
1. Create two buffer sections:
buffers {
size_kb: 65536
}
buffers {
# This is for ftrace/funcgraph
size_kb: 65536
}
And then in the "linux.ftrace" data source say target_buffer:1 (They are 0-indexed, so 1 is the 2nd)
data_sources {
config {
name: "linux.ftrace"
target_buffer: 1
ftrace_config {
enable_function_graph: true
}
}
}