mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
fgraph: Add new fgraph_ops structure to enable function graph hooks
Currently the registering of function graph is to pass in a entry and return function. We need to have a way to associate those functions together where the entry can determine to run the return hook. Having a structure that contains both functions will facilitate the process of converting the code to be able to do such. This is similar to the way function hooks are enabled (it passes in ftrace_ops). Instead of passing in the functions to use, a single structure is passed in to the registering function. The unregister function is now passed in the fgraph_ops handle. When we allow more than one callback to the function graph hooks, this will let the system know which one to remove. Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
parent
317e04ca90
commit
688f7089d8
7 changed files with 58 additions and 45 deletions
|
@ -345,17 +345,25 @@ static void trace_graph_thresh_return(struct ftrace_graph_ret *trace)
|
|||
trace_graph_return(trace);
|
||||
}
|
||||
|
||||
static struct fgraph_ops funcgraph_thresh_ops = {
|
||||
.entryfunc = &trace_graph_entry,
|
||||
.retfunc = &trace_graph_thresh_return,
|
||||
};
|
||||
|
||||
static struct fgraph_ops funcgraph_ops = {
|
||||
.entryfunc = &trace_graph_entry,
|
||||
.retfunc = &trace_graph_return,
|
||||
};
|
||||
|
||||
static int graph_trace_init(struct trace_array *tr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
set_graph_array(tr);
|
||||
if (tracing_thresh)
|
||||
ret = register_ftrace_graph(&trace_graph_thresh_return,
|
||||
&trace_graph_entry);
|
||||
ret = register_ftrace_graph(&funcgraph_thresh_ops);
|
||||
else
|
||||
ret = register_ftrace_graph(&trace_graph_return,
|
||||
&trace_graph_entry);
|
||||
ret = register_ftrace_graph(&funcgraph_ops);
|
||||
if (ret)
|
||||
return ret;
|
||||
tracing_start_cmdline_record();
|
||||
|
@ -366,7 +374,10 @@ static int graph_trace_init(struct trace_array *tr)
|
|||
static void graph_trace_reset(struct trace_array *tr)
|
||||
{
|
||||
tracing_stop_cmdline_record();
|
||||
unregister_ftrace_graph();
|
||||
if (tracing_thresh)
|
||||
unregister_ftrace_graph(&funcgraph_thresh_ops);
|
||||
else
|
||||
unregister_ftrace_graph(&funcgraph_ops);
|
||||
}
|
||||
|
||||
static int graph_trace_update_thresh(struct trace_array *tr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue