aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-10-05 13:26:18 -0400
committerIngo Molnar <mingo@elte.hu>2009-10-05 14:35:23 -0400
commita2a99e8e12798706ec1026e5d8fc36f7c86122ce (patch)
treee5f3f236ad600b5221d1ecd9217ca6fdbd2f7b58 /tools/perf/util
parentaf427bf529c5991be8d1a36f43e2d0141f532f63 (diff)
perf tools: /proc/modules names don't always match its name
$ cut -d' ' -f1 /proc/modules|grep _|wc -l 29 $ cut -d' ' -f1 /proc/modules|grep _|sed 's/$/.ko'/g|while read n;do find /lib/modules/`uname -r` -name $n;done|wc -l 12 For instance: $ grep ^aes_x86 /proc/modules aes_x86_64 9056 2 - Live 0xffffffffa0091000 $ l /lib/modules/2.6.31-tip/kernel/arch/x86/crypto/aes-x86_64.ko -rw-r--r-- 1 root root 136438 2009-09-22 19:05 /lib/modules/2.6.31-tip/kernel/arch/x86/crypto/aes-x86_64.ko Handle that by introducing a strxfrchar routine that replaces dashes with underscores when matching file names to loaded modules. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Mike Galbraith <efault@gmx.de> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/string.c11
-rw-r--r--tools/perf/util/string.h1
-rw-r--r--tools/perf/util/symbol.c3
3 files changed, 14 insertions, 1 deletions
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c
index c93eca9a7be3..04743d3e9039 100644
--- a/tools/perf/util/string.c
+++ b/tools/perf/util/string.c
@@ -1,3 +1,4 @@
1#include <string.h>
1#include "string.h" 2#include "string.h"
2 3
3static int hex(char ch) 4static int hex(char ch)
@@ -32,3 +33,13 @@ int hex2u64(const char *ptr, u64 *long_val)
32 33
33 return p - ptr; 34 return p - ptr;
34} 35}
36
37char *strxfrchar(char *s, char from, char to)
38{
39 char *p = s;
40
41 while ((p = strchr(p, from)) != NULL)
42 *p++ = to;
43
44 return s;
45}
diff --git a/tools/perf/util/string.h b/tools/perf/util/string.h
index 15c827475e7d..2c84bf65ba0f 100644
--- a/tools/perf/util/string.h
+++ b/tools/perf/util/string.h
@@ -4,6 +4,7 @@
4#include "types.h" 4#include "types.h"
5 5
6int hex2u64(const char *ptr, u64 *val); 6int hex2u64(const char *ptr, u64 *val);
7char *strxfrchar(char *s, char from, char to);
7 8
8#define _STR(x) #x 9#define _STR(x) #x
9#define STR(x) _STR(x) 10#define STR(x) _STR(x)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 4dfdefd5ec7e..e3eebdd682d9 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -189,7 +189,7 @@ struct symbol *dso__find_symbol(struct dso *self, u64 ip)
189 189
190size_t dso__fprintf(struct dso *self, FILE *fp) 190size_t dso__fprintf(struct dso *self, FILE *fp)
191{ 191{
192 size_t ret = fprintf(fp, "dso: %s\n", self->long_name); 192 size_t ret = fprintf(fp, "dso: %s\n", self->short_name);
193 193
194 struct rb_node *nd; 194 struct rb_node *nd;
195 for (nd = rb_first(&self->syms); nd; nd = rb_next(nd)) { 195 for (nd = rb_first(&self->syms); nd; nd = rb_next(nd)) {
@@ -977,6 +977,7 @@ static int dsos__load_modules_sym_dir(char *dirname,
977 snprintf(dso_name, sizeof(dso_name), "[%.*s]", 977 snprintf(dso_name, sizeof(dso_name), "[%.*s]",
978 (int)(dot - dent->d_name), dent->d_name); 978 (int)(dot - dent->d_name), dent->d_name);
979 979
980 strxfrchar(dso_name, '-', '_');
980 map = kernel_maps__find_by_dso_name(dso_name); 981 map = kernel_maps__find_by_dso_name(dso_name);
981 if (map == NULL) 982 if (map == NULL)
982 continue; 983 continue;