public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Mike Galbraith <efault@gmx.de>,
	Namhyung Kim <namhyung@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>,
	Ingo Molnar <mingo@kernel.org>
Subject: [PATCH V3 05/10] perf tools: avoid SyS kernel syscall aliases
Date: Fri,  2 Aug 2013 13:10:47 +0300	[thread overview]
Message-ID: <1375438252-24776-6-git-send-email-adrian.hunter@intel.com> (raw)
In-Reply-To: <1375438252-24776-1-git-send-email-adrian.hunter@intel.com>

When removing duplicate symbols, prefer to remove
syscall aliases starting with SyS or compat_SyS.

A side-effect of that is that it results in slightly
improved results for the "vmlinux symtab matches kallsyms"
test.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/util/symbol.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b407c53..04300dd 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -87,6 +87,7 @@ static int choose_best_symbol(struct symbol *syma, struct symbol *symb)
 {
 	s64 a;
 	s64 b;
+	size_t na, nb;
 
 	/* Prefer a symbol with non zero length */
 	a = syma->end - syma->start;
@@ -120,11 +121,21 @@ static int choose_best_symbol(struct symbol *syma, struct symbol *symb)
 	else if (a > b)
 		return SYMBOL_B;
 
-	/* If all else fails, choose the symbol with the longest name */
-	if (strlen(syma->name) >= strlen(symb->name))
+	/* Choose the symbol with the longest name */
+	na = strlen(syma->name);
+	nb = strlen(symb->name);
+	if (na > nb)
 		return SYMBOL_A;
-	else
+	else if (na < nb)
+		return SYMBOL_B;
+
+	/* Avoid "SyS" kernel syscall aliases */
+	if (na >= 3 && !strncmp(syma->name, "SyS", 3))
 		return SYMBOL_B;
+	if (na >= 10 && !strncmp(syma->name, "compat_SyS", 10))
+		return SYMBOL_B;
+
+	return SYMBOL_A;
 }
 
 void symbols__fixup_duplicate(struct rb_root *symbols)
-- 
1.7.11.7


  parent reply	other threads:[~2013-08-02 10:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-02 10:10 [PATCH V3 0/10] perf tools: add support for reading object code Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 01/10] perf tools: add test " Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 02/10] perf tools: load kernel maps before using Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 03/10] perf tools: make it possible to read object code from vmlinux Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 04/10] perf tools: adjust the vmlinux symtab matches kallsyms test Adrian Hunter
2013-08-02 10:10 ` Adrian Hunter [this message]
2013-08-02 10:10 ` [PATCH V3 06/10] perf tools: make it possible to read object code from kernel modules Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 07/10] perf tools: add support for reading from /proc/kcore Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 08/10] perf tools: adjust the vmlinux symtab matches kallsyms test again Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 09/10] perf tools: add kcore to the object code reading test Adrian Hunter
2013-08-02 10:10 ` [PATCH V3 10/10] perf tools: allow annotation using /proc/kcore Adrian Hunter
2013-08-05 19:59   ` Arnaldo Carvalho de Melo
2013-08-06 10:11     ` Adrian Hunter

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=1375438252-24776-6-git-send-email-adrian.hunter@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@ghostprotocols.net \
    --cc=dsahern@gmail.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@gmail.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.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