All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arun Sharma <asharma@fb.com>
To: Namhyung Kim <namhyung.kim@lge.com>
Cc: Arun Sharma <asharma@fb.com>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Mike Galbraith <efault@gmx.de>, Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>,
	Tom Zanussi <tzanussi@gmail.com>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf: Add a new sort order: SORT_INCLUSIVE (v3)
Date: Wed, 14 Mar 2012 10:36:23 -0700	[thread overview]
Message-ID: <20120314173623.GA6525@dev3310.snc6.facebook.com> (raw)
In-Reply-To: <4F60078D.10905@lge.com>

On Wed, Mar 14, 2012 at 11:50:53AM +0900, Namhyung Kim wrote:
> Hi Arun,
> [...]

Thanks for reviewing. Please take a look at this incremental patch.
I'll mail the v4 patch next.

 -Arun

diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index aa4acde..2b824a5 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -465,7 +465,8 @@ int callchain_get(struct callchain_cursor *cursor,
 {
 	struct callchain_cursor_node *node = cursor->curr;
 
-	if (node == NULL) return -1;
+	if (node == NULL)
+		return -1;
 
 	al->map = node->map;
 	al->sym = node->sym;
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 9d703ec..f3200ea 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -79,7 +79,6 @@ static void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
 static void hist_entry__add_cpumode_period(struct hist_entry *he,
 					   unsigned int cpumode, u64 period)
 {
-	he->period_self += period;
 	switch (cpumode) {
 	case PERF_RECORD_MISC_KERNEL:
 		he->period_sys += period;
@@ -213,7 +212,6 @@ static struct hist_entry *___hists__add_entry(struct hists *hists,
 		.ip	= al->addr,
 		.level	= al->level,
 		.period	= period,
-		.period_self = period,
 		.parent = sym_parent,
 		.filtered = symbol__parent_filter(sym_parent),
 	};
@@ -280,13 +278,11 @@ static struct hist_entry *__hists__add_entry_inclusive(struct hists *hists,
 
 		new_cursor.first = iter.curr;
 		new_cursor.nr = cursor->nr - i;
-		if (i != 0)
-			he->period_self -= period;
-		else
+		if (i == 0) {
+			he->period_self += period;
 			orig_he = he;
-		err = callchain_append(he->callchain,
-				       &new_cursor,
-				       period);
+		}
+		err = callchain_append(he->callchain, &new_cursor, period);
 		if (err)
 			return NULL;
 		callchain_cursor_advance(&iter);
@@ -306,6 +302,7 @@ static struct hist_entry *__hists__add_entry_single(struct hists *hists,
 	he = ___hists__add_entry(hists, al, sym_parent, period);
 	if (he == NULL)
 		return NULL;
+	he->period_self += period;
 	if (symbol_conf.use_callchain) {
 		err = callchain_append(he->callchain, cursor, period);
 		if (err)
@@ -322,7 +319,7 @@ struct hist_entry *__hists__add_entry(struct hists *hists,
 {
 	struct hist_entry *he;
 
-	if (sort__first_dimension == SORT_INCLUSIVE)
+	if (sort__has_inclusive && symbol_conf.use_callchain)
 		he = __hists__add_entry_inclusive(hists, al, parent,
 						  cursor, period);
 	else
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index f7c93d9..9033a62 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -8,6 +8,7 @@ const char	default_sort_order[] = "comm,dso,symbol";
 const char	*sort_order = default_sort_order;
 int		sort__need_collapse = 0;
 int		sort__has_parent = 0;
+int		sort__has_inclusive = 0;
 
 enum sort_type	sort__first_dimension;
 
@@ -291,6 +292,9 @@ int sort_dimension__add(const char *tok)
 			sort__has_parent = 1;
 		}
 
+		if (sd->entry == &sort_sym_inclusive)
+			sort__has_inclusive = 1;
+
 		if (sd->taken)
 			return 0;
 
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index efb145f..97f67d5 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -31,6 +31,7 @@ extern const char *parent_pattern;
 extern const char default_sort_order[];
 extern int sort__need_collapse;
 extern int sort__has_parent;
+extern int sort__has_inclusive;
 extern char *field_sep;
 extern struct sort_entry sort_comm;
 extern struct sort_entry sort_dso;

      reply	other threads:[~2012-03-14 17:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-13 18:46 [PATCH] perf: Add a new sort order: SORT_INCLUSIVE (v3) Arun Sharma
2012-03-14  2:50 ` Namhyung Kim
2012-03-14 17:36   ` Arun Sharma [this message]

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=20120314173623.GA6525@dev3310.snc6.facebook.com \
    --to=asharma@fb.com \
    --cc=acme@redhat.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung.kim@lge.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=tzanussi@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.