public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Lai Jiangshan <laijs@cn.fujitsu.com>,
	Steven Rostedt <srostedt@redhat.com>
Subject: Re: [PATCH 7/7] function-graph: show binary events as comments
Date: Thu, 19 Mar 2009 21:52:20 +0100	[thread overview]
Message-ID: <20090319205219.GB5935@nowhere> (raw)
In-Reply-To: <20090319200201.217098940@goodmis.org>

On Thu, Mar 19, 2009 at 04:01:29PM -0400, Steven Rostedt wrote:
> From: Steven Rostedt <srostedt@redhat.com>
> 
> With the added TRACE_EVENT macro, the events no longer appear in
> the function graph tracer. This was because the function graph
> did not know how to display the entries. The graph tracer was
> only aware of its own entries and the printk entries.
> 
> By using the event call back feature, the graph tracer can now display
> the events.
> 
>  # echo irq > /debug/tracing/set_event
> 
> Which can show:
> 
>  0)               |          handle_IRQ_event() {
>  0)               |            /* irq_handler_entry: irq=48 handler=eth0 */
>  0)               |            e1000_intr() {
>  0)   0.926 us    |              __napi_schedule();
>  0)   3.888 us    |            }
>  0)               |            /* irq_handler_exit: irq=48 return=handled */
>  0)   0.655 us    |            runqueue_is_locked();
>  0)               |            __wake_up() {
>  0)   0.831 us    |              _spin_lock_irqsave();
> 
> The irq entry and exit events show up as comments.
> 
> Signed-off-by: Steven Rostedt <srostedt@redhat.com>


Thanks a lot for this whole patchset :-)

Frederic.


> ---
>  kernel/trace/trace_functions_graph.c |   40 +++++++++++++++++++++++----------
>  1 files changed, 28 insertions(+), 12 deletions(-)
> 
> diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
> index 66ea23b..e876816 100644
> --- a/kernel/trace/trace_functions_graph.c
> +++ b/kernel/trace/trace_functions_graph.c
> @@ -712,10 +712,12 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
>  }
>  
>  static enum print_line_t
> -print_graph_comment(struct bprint_entry *trace, struct trace_seq *s,
> -		   struct trace_entry *ent, struct trace_iterator *iter)
> +print_graph_comment(struct trace_seq *s,  struct trace_entry *ent,
> +		    struct trace_iterator *iter)
>  {
> +	unsigned long sym_flags = (trace_flags & TRACE_ITER_SYM_MASK);
>  	struct fgraph_data *data = iter->private;
> +	struct trace_event *event;
>  	int depth = 0;
>  	int ret;
>  	int i;
> @@ -751,9 +753,26 @@ print_graph_comment(struct bprint_entry *trace, struct trace_seq *s,
>  	if (!ret)
>  		return TRACE_TYPE_PARTIAL_LINE;
>  
> -	ret = trace_seq_bprintf(s, trace->fmt, trace->buf);
> -	if (!ret)
> -		return TRACE_TYPE_PARTIAL_LINE;
> +	switch (iter->ent->type) {
> +	case TRACE_BPRINT:
> +		ret = trace_print_bprintk_msg_only(iter);
> +		if (ret != TRACE_TYPE_HANDLED)
> +			return ret;
> +		break;
> +	case TRACE_PRINT:
> +		ret = trace_print_printk_msg_only(iter);
> +		if (ret != TRACE_TYPE_HANDLED)
> +			return ret;
> +		break;
> +	default:
> +		event = ftrace_find_event(ent->type);
> +		if (!event)
> +			return TRACE_TYPE_UNHANDLED;
> +
> +		ret = event->trace(iter, sym_flags);
> +		if (ret != TRACE_TYPE_HANDLED)
> +			return ret;
> +	}
>  
>  	/* Strip ending newline */
>  	if (s->buffer[s->len - 1] == '\n') {
> @@ -772,8 +791,8 @@ print_graph_comment(struct bprint_entry *trace, struct trace_seq *s,
>  enum print_line_t
>  print_graph_function(struct trace_iterator *iter)
>  {
> -	struct trace_seq *s = &iter->seq;
>  	struct trace_entry *entry = iter->ent;
> +	struct trace_seq *s = &iter->seq;
>  
>  	switch (entry->type) {
>  	case TRACE_GRAPH_ENT: {
> @@ -786,14 +805,11 @@ print_graph_function(struct trace_iterator *iter)
>  		trace_assign_type(field, entry);
>  		return print_graph_return(&field->ret, s, entry, iter);
>  	}
> -	case TRACE_BPRINT: {
> -		struct bprint_entry *field;
> -		trace_assign_type(field, entry);
> -		return print_graph_comment(field, s, entry, iter);
> -	}
>  	default:
> -		return TRACE_TYPE_UNHANDLED;
> +		return print_graph_comment(s, entry, iter);
>  	}
> +
> +	return TRACE_TYPE_HANDLED;
>  }
>  
>  static void print_graph_headers(struct seq_file *s)
> -- 
> 1.6.2
> 
> -- 


  reply	other threads:[~2009-03-19 20:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-19 20:01 [PATCH 0/7] [GIT PULL] tip/tracing/ftrace Steven Rostedt
2009-03-19 20:01 ` [PATCH 1/7] tracing: give easy way to clear trace buffer Steven Rostedt
2009-03-19 20:26   ` Frederic Weisbecker
2009-03-19 23:52     ` Steven Rostedt
2009-03-19 20:01 ` [PATCH 2/7] ftrace: protect running nmi (V3) Steven Rostedt
2009-03-19 20:01 ` [PATCH 3/7] function-graph: consolidate prologues for output Steven Rostedt
2009-03-19 20:01 ` [PATCH 4/7] tracing: make print_(b)printk_msg_only global Steven Rostedt
2009-03-19 20:01 ` [PATCH 5/7] function-graph: calculate function depth within function graph tracer Steven Rostedt
2009-03-19 20:01 ` [PATCH 6/7] tracing: remove recording function depth from trace_printk Steven Rostedt
2009-03-19 20:01 ` [PATCH 7/7] function-graph: show binary events as comments Steven Rostedt
2009-03-19 20:52   ` Frederic Weisbecker [this message]
2009-03-20  9:15 ` [PATCH 0/7] [GIT PULL] tip/tracing/ftrace Ingo Molnar
2009-03-20 10:14   ` Ingo Molnar
2009-03-20 13:56     ` Frederic Weisbecker
2009-03-20 16:02     ` Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090319205219.GB5935@nowhere \
    --to=fweisbec@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=srostedt@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox