summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2013-08-26 12:29:38 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-08-26 17:25:57 -0300
commitbeccb2b54a39ca5e49a7aa2912faa33617a45cc1 (patch)
tree805842bd7728c92c5211b5f6d897493e54b77dfb /tools/perf
parente5959683adb6b15cc2aebfbed5aa1315e24a53db (diff)
perf trace: Allow overiding the formatting of syscall fields
The mmap syscalls, for instance, don't have the FORMAT_IS_POINTER for its pointer arguments, override it. This also paves the way for more specialized argument beautifiers, like for mmap's prot and flags arguments. 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-mm864hvhrpt39muxmmbtjasz@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-trace.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 2d759f57f9d4..60ee811c5129 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -17,24 +17,35 @@ static size_t syscall_arg__scnprintf_hex(char *bf, size_t size, unsigned long ar
return scnprintf(bf, size, "%#lx", arg);
}
+#define SCA_HEX syscall_arg__scnprintf_hex
+
static struct syscall_fmt {
const char *name;
const char *alias;
+ size_t (*arg_scnprintf[6])(char *bf, size_t size, unsigned long arg);
bool errmsg;
bool timeout;
bool hexret;
} syscall_fmts[] = {
{ .name = "access", .errmsg = true, },
{ .name = "arch_prctl", .errmsg = true, .alias = "prctl", },
- { .name = "brk", .hexret = true, },
+ { .name = "brk", .hexret = true,
+ .arg_scnprintf = { [0] = SCA_HEX, /* brk */ }, },
{ .name = "mmap", .hexret = true, },
{ .name = "connect", .errmsg = true, },
{ .name = "fstat", .errmsg = true, .alias = "newfstat", },
{ .name = "fstatat", .errmsg = true, .alias = "newfstatat", },
{ .name = "futex", .errmsg = true, },
+ { .name = "ioctl", .errmsg = true,
+ .arg_scnprintf = { [2] = SCA_HEX, /* arg */ }, },
{ .name = "lstat", .errmsg = true, .alias = "newlstat", },
- { .name = "mmap", .hexret = true, },
+ { .name = "mmap", .hexret = true,
+ .arg_scnprintf = { [0] = SCA_HEX, /* addr */ }, },
+ { .name = "mprotect", .errmsg = true,
+ .arg_scnprintf = { [0] = SCA_HEX, /* addr */ }, },
{ .name = "mremap", .hexret = true, },
+ { .name = "munmap", .errmsg = true,
+ .arg_scnprintf = { [0] = SCA_HEX, /* addr */ }, },
{ .name = "open", .errmsg = true, },
{ .name = "poll", .errmsg = true, .timeout = true, },
{ .name = "ppoll", .errmsg = true, .timeout = true, },
@@ -232,7 +243,9 @@ static int syscall__set_arg_fmts(struct syscall *sc)
return -1;
for (field = sc->tp_format->format.fields->next; field; field = field->next) {
- if (field->flags & FIELD_IS_POINTER)
+ if (sc->fmt && sc->fmt->arg_scnprintf[idx])
+ sc->arg_scnprintf[idx] = sc->fmt->arg_scnprintf[idx];
+ else if (field->flags & FIELD_IS_POINTER)
sc->arg_scnprintf[idx] = syscall_arg__scnprintf_hex;
++idx;
}