aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2013-08-07 07:38:49 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-08-07 16:35:30 -0400
commit3445432b7b24665cf4693fc4794c62d4d768a978 (patch)
tree87160a25bde7232cb4b201b099919348e84a5320 /tools
parent2bbf03f16a634f675c49c473b2b6528571990aea (diff)
perf symbols: avoid SyS kernel syscall aliases
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> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1375875537-4509-6-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/symbol.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 02718e728d59..ea62ecd191fa 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)
87{ 87{
88 s64 a; 88 s64 a;
89 s64 b; 89 s64 b;
90 size_t na, nb;
90 91
91 /* Prefer a symbol with non zero length */ 92 /* Prefer a symbol with non zero length */
92 a = syma->end - syma->start; 93 a = syma->end - syma->start;
@@ -120,11 +121,21 @@ static int choose_best_symbol(struct symbol *syma, struct symbol *symb)
120 else if (a > b) 121 else if (a > b)
121 return SYMBOL_B; 122 return SYMBOL_B;
122 123
123 /* If all else fails, choose the symbol with the longest name */ 124 /* Choose the symbol with the longest name */
124 if (strlen(syma->name) >= strlen(symb->name)) 125 na = strlen(syma->name);
126 nb = strlen(symb->name);
127 if (na > nb)
125 return SYMBOL_A; 128 return SYMBOL_A;
126 else 129 else if (na < nb)
130 return SYMBOL_B;
131
132 /* Avoid "SyS" kernel syscall aliases */
133 if (na >= 3 && !strncmp(syma->name, "SyS", 3))
127 return SYMBOL_B; 134 return SYMBOL_B;
135 if (na >= 10 && !strncmp(syma->name, "compat_SyS", 10))
136 return SYMBOL_B;
137
138 return SYMBOL_A;
128} 139}
129 140
130void symbols__fixup_duplicate(struct rb_root *symbols) 141void symbols__fixup_duplicate(struct rb_root *symbols)