linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sam Liao <phyomh@gmail.com>
To: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] [perf] fix annotation loading when symbol sort order not used.
Date: Sun, 12 Jun 2011 02:09:40 +0800	[thread overview]
Message-ID: <BANLkTinXzHiCTb6EWWGSJmzz5dS1P9p1sg@mail.gmail.com> (raw)

When "symbol" is not in "-s" sort order options, the hist entry's
ms.sym is not equal to sample's addr_location.sym where we should
not load annotation. This fix check if symbol sort order used, if
not, disable symbol annonation for report command in tui mode.
---
 tools/perf/builtin-report.c |    2 +-
 tools/perf/util/sort.c      |    5 +++++
 tools/perf/util/sort.h      |    1 +
 3 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 2ceac45..83ba06b 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -79,7 +79,7 @@ static int perf_session__add_hist_entry(struct
perf_session *session,
 	 * so we don't allocated the extra space needed because the stdio
 	 * code will not use it.
 	 */
-	if (al->sym != NULL && use_browser > 0) {
+	if (sort__has_symbol && al->sym != NULL && use_browser > 0) {
 		struct annotation *notes = symbol__annotation(he->ms.sym);

 		assert(evsel != NULL);
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index f44fa54..a6e1e13 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_symbol = 0;

 enum sort_type	sort__first_dimension;

@@ -294,6 +295,10 @@ int sort_dimension__add(const char *tok)
 			sort__has_parent = 1;
 		}

+		if (sd->entry == &sort_sym) {
+			sort__has_symbol = 1;
+		}
+
 		if (list_empty(&hist_entry__sort_list)) {
 			if (!strcmp(sd->name, "pid"))
 				sort__first_dimension = SORT_PID;
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 0b91053..404de31 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_symbol;
 extern char *field_sep;
 extern struct sort_entry sort_comm;
 extern struct sort_entry sort_dso;
-- 
1.7.4.1

             reply	other threads:[~2011-06-11 18:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-11 18:09 Sam Liao [this message]
2011-06-14 22:03 ` [PATCH] [perf] fix annotation loading when symbol sort order not used Arun Sharma

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=BANLkTinXzHiCTb6EWWGSJmzz5dS1P9p1sg@mail.gmail.com \
    --to=phyomh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.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).