diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-10-05 19:26:18 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-05 20:35:23 +0200 |
commit | a2a99e8e12798706ec1026e5d8fc36f7c86122ce (patch) | |
tree | e5f3f236ad600b5221d1ecd9217ca6fdbd2f7b58 /tools/perf/util/string.c | |
parent | perf tools: Create maps for modules when processing kallsyms (diff) | |
download | linux-a2a99e8e12798706ec1026e5d8fc36f7c86122ce.tar.xz linux-a2a99e8e12798706ec1026e5d8fc36f7c86122ce.zip |
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/string.c')
-rw-r--r-- | tools/perf/util/string.c | 11 |
1 files changed, 11 insertions, 0 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 @@ +#include <string.h> #include "string.h" static int hex(char ch) @@ -32,3 +33,13 @@ int hex2u64(const char *ptr, u64 *long_val) return p - ptr; } + +char *strxfrchar(char *s, char from, char to) +{ + char *p = s; + + while ((p = strchr(p, from)) != NULL) + *p++ = to; + + return s; +} |