2018-11-16 22:41:25

by Timur Tabi

[permalink] [raw]
Subject: Enable tracing only for one function and its children?

Is there a way to enable ftrace tracing only for one specific function
and all the functions it calls? Then when the function returns,
disable tracing until the next time?

When I pass the function name only to set_ftrace_filter, it literally
only traces that function, which doesn't help me. I tried setting
writing "nvidia_ioctl:traceon" to set_ftrace_filter, but that just
gave me an "invalid argument" error. And even if that did work, I
don't know what function to use for :traceoff.


2018-11-16 22:53:47

by Keith Busch

[permalink] [raw]
Subject: Re: Enable tracing only for one function and its children?

On Fri, Nov 16, 2018 at 04:37:55PM -0600, Timur Tabi wrote:
> Is there a way to enable ftrace tracing only for one specific function
> and all the functions it calls? Then when the function returns,
> disable tracing until the next time?
>
> When I pass the function name only to set_ftrace_filter, it literally
> only traces that function, which doesn't help me.

I think you're looking for the set_graph_function option for the
function_graph tracer.