diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-08-23 09:48:33 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-08-26 16:26:02 -0400 |
commit | 941557e0e4e90bbf970f4241c26055a4683e9c0d (patch) | |
tree | 9d8ac5e869343649f813505249304487e72aa434 /tools | |
parent | ae685380b9a1ffe5e1935852ec11f0aa38b1d77b (diff) |
perf trace: Add beautifier for mmap flags parm
[root@zoo ~]# perf trace -e mmap,mprotect sleep 1
0.992 ( 0.015 ms): mmap(addr: 0, len: 4096, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS, fd: 4294967295, off: 0) = 0xa60be000
1.108 ( 0.012 ms): mmap(addr: 0, len: 125100, prot: READ, flags: PRIVATE, fd: 3, off: 0 ) = 0xa609f000
1.209 ( 0.014 ms): mmap(addr: 0x33c1600000, len: 3896312, prot: EXEC|READ, flags: PRIVATE|DENYWRITE, fd: 3, off: 0) = 0xc1600000
1.232 ( 0.018 ms): mprotect(start: 0x33c17ad000, len: 2097152, prot: NONE ) = 0
1.255 ( 0.018 ms): mmap(addr: 0x33c19ad000, len: 24576, prot: READ|WRITE, flags: PRIVATE|DENYWRITE|FIXED, fd: 3, off: 1757184) = 0xc19ad000
1.281 ( 0.011 ms): mmap(addr: 0x33c19b3000, len: 17400, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS|FIXED, fd: 4294967295, off: 0) = 0xc19b3000
1.328 ( 0.008 ms): mmap(addr: 0, len: 4096, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS, fd: 4294967295, off: 0) = 0xa609e000
1.346 ( 0.008 ms): mmap(addr: 0, len: 8192, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS, fd: 4294967295, off: 0) = 0xa609c000
1.443 ( 0.013 ms): mprotect(start: 0x606000, len: 4096, prot: READ ) = 0
1.459 ( 0.011 ms): mprotect(start: 0x33c19ad000, len: 16384, prot: READ ) = 0
1.477 ( 0.011 ms): mprotect(start: 0x33c1420000, len: 4096, prot: READ ) = 0
1.855 ( 0.013 ms): mmap(addr: 0, len: 104789808, prot: READ, flags: PRIVATE, fd: 3, off: 0) = 0x9fcac000
[root@zoo ~]#
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-q1ubhdd9wigxneam616ggdsn@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-trace.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 81c20a6cc6b7..034152c7e974 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -50,6 +50,44 @@ static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size, unsigned l | |||
50 | 50 | ||
51 | #define SCA_MMAP_PROT syscall_arg__scnprintf_mmap_prot | 51 | #define SCA_MMAP_PROT syscall_arg__scnprintf_mmap_prot |
52 | 52 | ||
53 | static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size, unsigned long arg) | ||
54 | { | ||
55 | int printed = 0, flags = arg; | ||
56 | |||
57 | #define P_MMAP_FLAG(n) \ | ||
58 | if (flags & MAP_##n) { \ | ||
59 | printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \ | ||
60 | flags &= ~MAP_##n; \ | ||
61 | } | ||
62 | |||
63 | P_MMAP_FLAG(SHARED); | ||
64 | P_MMAP_FLAG(PRIVATE); | ||
65 | P_MMAP_FLAG(32BIT); | ||
66 | P_MMAP_FLAG(ANONYMOUS); | ||
67 | P_MMAP_FLAG(DENYWRITE); | ||
68 | P_MMAP_FLAG(EXECUTABLE); | ||
69 | P_MMAP_FLAG(FILE); | ||
70 | P_MMAP_FLAG(FIXED); | ||
71 | P_MMAP_FLAG(GROWSDOWN); | ||
72 | P_MMAP_FLAG(HUGETLB); | ||
73 | P_MMAP_FLAG(LOCKED); | ||
74 | P_MMAP_FLAG(NONBLOCK); | ||
75 | P_MMAP_FLAG(NORESERVE); | ||
76 | P_MMAP_FLAG(POPULATE); | ||
77 | P_MMAP_FLAG(STACK); | ||
78 | #ifdef MAP_UNINITIALIZED | ||
79 | P_MMAP_FLAG(UNINITIALIZED); | ||
80 | #endif | ||
81 | #undef P_MMAP_FLAG | ||
82 | |||
83 | if (flags) | ||
84 | printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags); | ||
85 | |||
86 | return printed; | ||
87 | } | ||
88 | |||
89 | #define SCA_MMAP_FLAGS syscall_arg__scnprintf_mmap_flags | ||
90 | |||
53 | static struct syscall_fmt { | 91 | static struct syscall_fmt { |
54 | const char *name; | 92 | const char *name; |
55 | const char *alias; | 93 | const char *alias; |
@@ -72,7 +110,8 @@ static struct syscall_fmt { | |||
72 | { .name = "lstat", .errmsg = true, .alias = "newlstat", }, | 110 | { .name = "lstat", .errmsg = true, .alias = "newlstat", }, |
73 | { .name = "mmap", .hexret = true, | 111 | { .name = "mmap", .hexret = true, |
74 | .arg_scnprintf = { [0] = SCA_HEX, /* addr */ | 112 | .arg_scnprintf = { [0] = SCA_HEX, /* addr */ |
75 | [2] = SCA_MMAP_PROT, /* prot */ }, }, | 113 | [2] = SCA_MMAP_PROT, /* prot */ |
114 | [3] = SCA_MMAP_FLAGS, /* flags */ }, }, | ||
76 | { .name = "mprotect", .errmsg = true, | 115 | { .name = "mprotect", .errmsg = true, |
77 | .arg_scnprintf = { [0] = SCA_HEX, /* start */ | 116 | .arg_scnprintf = { [0] = SCA_HEX, /* start */ |
78 | [2] = SCA_MMAP_PROT, /* prot */ }, }, | 117 | [2] = SCA_MMAP_PROT, /* prot */ }, }, |