mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
function-graph: Add tracing_thresh support to function_graph tracer
Add support for tracing_thresh to the function_graph tracer. This version of this feature isolates the checks into new entry and return functions, to avoid adding more conditional code into the main function_graph paths. When the tracing_thresh is set and the function graph tracer is enabled, only the functions that took longer than the time in microseconds that was set in tracing_thresh are recorded. To do this efficiently, only the function exits are recorded: [tracing]# echo 100 > tracing_thresh [tracing]# echo function_graph > current_tracer [tracing]# cat trace # tracer: function_graph # # CPU DURATION FUNCTION CALLS # | | | | | | | 1) ! 119.214 us | } /* smp_apic_timer_interrupt */ 1) <========== | 0) ! 101.527 us | } /* __rcu_process_callbacks */ 0) ! 126.461 us | } /* rcu_process_callbacks */ 0) ! 145.111 us | } /* __do_softirq */ 0) ! 149.667 us | } /* do_softirq */ 0) ! 168.817 us | } /* irq_exit */ 0) ! 248.254 us | } /* smp_apic_timer_interrupt */ Also, add support for specifying tracing_thresh on the kernel command line. When used like so: "tracing_thresh=200 ftrace=function_graph" this can be used to analyse system startup. It is important to disable tracing soon after boot, in order to avoid losing the trace data. Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Tim Bird <tim.bird@am.sony.com> LKML-Reference: <4B87098B.4040308@am.sony.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
parent
1acaa1b2d9
commit
0e95017355
3 changed files with 43 additions and 5 deletions
|
@ -237,6 +237,14 @@ int trace_graph_entry(struct ftrace_graph_ent *trace)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int trace_graph_thresh_entry(struct ftrace_graph_ent *trace)
|
||||
{
|
||||
if (tracing_thresh)
|
||||
return 1;
|
||||
else
|
||||
return trace_graph_entry(trace);
|
||||
}
|
||||
|
||||
static void __trace_graph_return(struct trace_array *tr,
|
||||
struct ftrace_graph_ret *trace,
|
||||
unsigned long flags,
|
||||
|
@ -290,13 +298,26 @@ void set_graph_array(struct trace_array *tr)
|
|||
smp_mb();
|
||||
}
|
||||
|
||||
void trace_graph_thresh_return(struct ftrace_graph_ret *trace)
|
||||
{
|
||||
if (tracing_thresh &&
|
||||
(trace->rettime - trace->calltime < tracing_thresh))
|
||||
return;
|
||||
else
|
||||
trace_graph_return(trace);
|
||||
}
|
||||
|
||||
static int graph_trace_init(struct trace_array *tr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
set_graph_array(tr);
|
||||
ret = register_ftrace_graph(&trace_graph_return,
|
||||
&trace_graph_entry);
|
||||
if (tracing_thresh)
|
||||
ret = register_ftrace_graph(&trace_graph_thresh_return,
|
||||
&trace_graph_thresh_entry);
|
||||
else
|
||||
ret = register_ftrace_graph(&trace_graph_return,
|
||||
&trace_graph_entry);
|
||||
if (ret)
|
||||
return ret;
|
||||
tracing_start_cmdline_record();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue