tracing/function-graph-tracer: handle the leaf functions from trace_pipe
PATCH 1/1 tracing/function-graph-tracer: handle the leaf functions from trace_pipe
When one cat on the trace file, the leaf functions are printed without brackets:
function();
whereas in the trace_pipe file we'll see the following:
function() {
}
This is because the ring_buffer handling is not the same between those two files. On the trace file, when an entry is printed, the iterator advanced and then we can check the next entry.
There is no iterator with trace_pipe, the current entry to print has been peeked and not consumed. So checking the next entry will still return the current one while we don't consume it.
This patch introduces a new value for the output callbacks to ask the tracing core to not consume the current entry after printing it.
We need it because we will have to consume the current entry ourself to check the next one.
Now the trace_pipe is able to handle well the leaf functions.
--- kernel/trace/trace.c | 4 +- kernel/trace/trace.h | 7 +++-- kernel/trace/trace_functions_graph.c | 48 +++++++++++++++++++++------------ 3 files changed, 36 insertions(+), 23 deletions(-)
kernel/trace/trace.c +2 -2
@@ -2459,8 +2459,8 @@ waitagain: iter->seq.len = len;break ; } - -trace_consume (iter); +if (ret !=TRACE_TYPE_NO_CONSUME ) +trace_consume (iter);if (iter->seq.len >= cnt)break ;
kernel/trace/trace.h +4 -3
@@ -63,13 +63,13 @@ struct ftrace_entry {/* Function call entry */ struct ftrace_graph_ent_entry { -struct trace_entry ent; +struct trace_entry ent;struct ftrace_graph_ent graph_ent; };/* Function return entry */ struct ftrace_graph_ret_entry { -struct trace_entry ent; +struct trace_entry ent;struct ftrace_graph_ret ret; };extern struct tracer boot_tracer;
@@ -309,7 +309,8 @@ extern void __ftrace_bad_type(void);enum print_line_t {TRACE_TYPE_PARTIAL_LINE =0 ,/* Retry after flushing the seq */ TRACE_TYPE_HANDLED =1 , -TRACE_TYPE_UNHANDLED =2 /* Relay to other output functions */ +TRACE_TYPE_UNHANDLED =2 ,/* Relay to other output functions */ +TRACE_TYPE_NO_CONSUME =3 /* Handled but ask to not consume */ };
kernel/trace/trace_functions_graph.c +30 -18
101 lines not on this page · raw message
Signature · 1 line
1.6.1
Quoted 17 lines · Frederic Weisbecker
When one cat on the trace file, the leaf functions are printed without brackets:
function();whereas in the
trace_pipefile we'll see the following:
function(){
}This is because the
ring_bufferhandling is not the same between those two files. On the trace file, when an entry is printed, the iterator advanced and then we can check the next entry.There is no iterator with
trace_pipe, the current entry to print has been peeked and not consumed. So checking the next entry will still return the current one while we don't consume it.
Quoted 7 lines
This patch introduces a new value for the output callbacks to ask the tracing core to not consume the current entry after printing it.
We need it because we will have to consume the current entry ourself to check the next one.Now the
trace_pipeis able to handle well the leaf functions.Signed-off-by Frederic Weisbecker <[email protected]>
Thanks Frederic,
-- Steve
Ingo Molnar
AppliedQuoted 21 lines · Frederic Weisbecker
When one cat on the trace file, the leaf functions are printed without brackets:
function();whereas in the
trace_pipefile we'll see the following:
function(){
}This is because the
ring_bufferhandling is not the same between those two files. On the trace file, when an entry is printed, the iterator advanced and then we can check the next entry.There is no iterator with
trace_pipe, the current entry to print has been peeked and not consumed. So checking the next entry will still return the current one while we don't consume it.This patch introduces a new value for the output callbacks to ask the tracing core to not consume the current entry after printing it.
We need it because we will have to consume the current entry ourself to check the next one.
Quoted 8 lines
Now the
trace_pipeis able to handle well the leaf functions.Signed-off-by Frederic Weisbecker <[email protected]>--- kernel/trace/trace.c | 4 +- kernel/trace/trace.h | 7 +++-- kernel/trace/trace_functions_graph.c | 48 +++++++++++++++++++++------------ 3 files changed, 36 insertions(+), 23 deletions(-)
Applied to tip/tracing/ftrace, thanks Frederic!
Ingo