linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung.kim@lge.com>,
	LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@redhat.com>,
	David Ahern <dsahern@gmail.com>,
	Stephane Eranian <eranian@google.com>,
	Pekka Enberg <penberg@kernel.org>
Subject: Re: [PATCH 3/5] perf gtk/hists: Display callchain overhead also
Date: Wed, 22 May 2013 11:52:15 +0200	[thread overview]
Message-ID: <20130522095215.GA2386@ghostprotocols.net> (raw)
In-Reply-To: <1369211258-3163-4-git-send-email-namhyung@kernel.org>

Em Wed, May 22, 2013 at 05:27:36PM +0900, Namhyung Kim escreveu:
> From: Namhyung Kim <namhyung.kim@lge.com>
> 
> Add a new column for showing callchain overhead.  I feel like it's
> more natural than having those overhead next to a first child in a
> same column.

Callchains in GTK, great! Some observations tho:

All those leaves with 0.00% looks ugly/not needed, right?

I took a screenshot and put at:

http://vger.kernel.org/~acme/perf-gtk-callchains.png

all those duplicated "+ callchain" when the callchain is folded, can you
remove those? I.e. leaving just the '+' to allow unfolding.

About using an extra column for the callchains... Can't it be like in
the TUI and in the stdio modes? Think about C++ long symbol names :-) 

I'll do some more testing on it and provide further comments, thanks for
doing this work!

- Arnaldo
 
> Cc: Pekka Enberg <penberg@kernel.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/ui/gtk/hists.c | 44 ++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 38 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
> index 14d0b26c7c8a..34a09c09748c 100644
> --- a/tools/perf/ui/gtk/hists.c
> +++ b/tools/perf/ui/gtk/hists.c
> @@ -134,7 +134,7 @@ static void callchain_list__sym_name(struct callchain_list *cl,
>  }
>  
>  static void perf_gtk__add_callchain(struct rb_root *root, GtkTreeStore *store,
> -				    GtkTreeIter *parent, int col)
> +				    GtkTreeIter *parent, int col, u64 total)
>  {
>  	struct rb_node *nd;
>  
> @@ -142,20 +142,36 @@ static void perf_gtk__add_callchain(struct rb_root *root, GtkTreeStore *store,
>  		struct callchain_node *node;
>  		struct callchain_list *chain;
>  		GtkTreeIter iter;
> +		double percent;
> +		u64 hits;
>  
>  		node = rb_entry(nd, struct callchain_node, rb_node);
>  
> +		hits = callchain_cumul_hits(node);
> +
> +		if (total)
> +			percent = 100.0 * hits / total;
> +		else
> +			percent = 0.0;
> +
>  		list_for_each_entry(chain, &node->val, list) {
>  			char buf[128];
>  
>  			gtk_tree_store_append(store, &iter, parent);
>  
> -			callchain_list__sym_name(chain, buf, sizeof(buf));
> +			scnprintf(buf, sizeof(buf), "%5.2f%%", percent);
>  			gtk_tree_store_set(store, &iter, col, buf, -1);
> +
> +			callchain_list__sym_name(chain, buf, sizeof(buf));
> +			gtk_tree_store_set(store, &iter, col + 1, buf, -1);
>  		}
>  
> +		if (callchain_param.mode == CHAIN_GRAPH_REL)
> +			total = node->children_hit;
> +
>  		/* Now 'iter' contains info of the last callchain_list */
> -		perf_gtk__add_callchain(&node->rb_root, store, &iter, col);
> +		perf_gtk__add_callchain(&node->rb_root, store, &iter, col,
> +					total);
>  	}
>  }
>  
> @@ -191,8 +207,10 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,
>  		col_types[nr_cols++] = G_TYPE_STRING;
>  	}
>  
> -	if (symbol_conf.use_callchain && sort__has_sym)
> +	if (symbol_conf.use_callchain && sort__has_sym) {
> +		col_types[nr_cols++] = G_TYPE_STRING;
>  		col_types[nr_cols++] = G_TYPE_STRING;
> +	}
>  
>  	store = gtk_tree_store_newv(nr_cols, col_types);
>  
> @@ -224,6 +242,11 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,
>  	if (symbol_conf.use_callchain && sort__has_sym) {
>  		GtkTreeViewColumn *chain_column;
>  
> +		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view),
> +							    -1, "Call %",
> +							    renderer, "text",
> +							    col_idx++, NULL);
> +
>  		chain_column = gtk_tree_view_column_new();
>  
>  		gtk_tree_view_column_set_title(chain_column, "Callchains");
> @@ -278,8 +301,17 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists,
>  		}
>  
>  		if (symbol_conf.use_callchain && sort__has_sym) {
> -			gtk_tree_store_set(store, &iter, col_idx, "callchain", -1);
> -			perf_gtk__add_callchain(&h->sorted_chain, store, &iter, col_idx);
> +			u64 total;
> +
> +			if (callchain_param.mode == CHAIN_GRAPH_REL)
> +				total = h->stat.period;
> +			else
> +				total = hists->stats.total_period;
> +
> +			gtk_tree_store_set(store, &iter, col_idx + 1,
> +					   "callchain", -1);
> +			perf_gtk__add_callchain(&h->sorted_chain, store, &iter,
> +						col_idx, total);
>  		}
>  	}
>  
> -- 
> 1.7.11.7

  parent reply	other threads:[~2013-05-22 12:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-22  8:27 [PATCH 0/5] perf report: Add support for callchains on GTK browser Namhyung Kim
2013-05-22  8:27 ` [PATCH 1/5] perf gtk/hists: Use GtkTreeStore instead of GtkListStore Namhyung Kim
2013-05-22  8:37   ` Pekka Enberg
2013-05-22  8:27 ` [PATCH 2/5] perf gtk/hists: Add support for callchains Namhyung Kim
2013-05-22  8:38   ` Pekka Enberg
2013-05-22  8:27 ` [PATCH 3/5] perf gtk/hists: Display callchain overhead also Namhyung Kim
2013-05-22  8:39   ` Pekka Enberg
2013-05-22  9:52   ` Arnaldo Carvalho de Melo [this message]
2013-05-23  2:37     ` Namhyung Kim
2013-05-28  8:48     ` Ingo Molnar
2013-06-02  2:50       ` Namhyung Kim
2013-05-22  8:27 ` [PATCH 4/5] perf gtk/hists: Add a double-click handler for callchains Namhyung Kim
2013-05-22  8:39   ` Pekka Enberg
2013-05-22  8:27 ` [PATCH 5/5] perf gtk/hists: Make column headers resizable Namhyung Kim
2013-05-22  8:37   ` [PATCH v2 " Namhyung Kim
2013-05-22  8:39     ` Pekka Enberg
2013-05-22  8:40 ` [PATCH 0/5] perf report: Add support for callchains on GTK browser Pekka Enberg

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=20130522095215.GA2386@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=penberg@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).