Skip to content

Commit

Permalink
perf trace: Add beautifier for lseek's whence arg
Browse files Browse the repository at this point in the history
 [root@zoo ~]# perf trace -a -e lseek | head -1
    546.922 ( 0.004 ms): 1184 lseek(fd: 26, offset: 0, whence: CUR) = 2
 [root@zoo ~]#

Cc: Adrian Hunter <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Sep 2, 2013
1 parent 0b8c25d commit 579e786
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tools/perf/builtin-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,31 @@ static size_t syscall_arg__scnprintf_hex(char *bf, size_t size,

#define SCA_HEX syscall_arg__scnprintf_hex

static size_t syscall_arg__scnprintf_whence(char *bf, size_t size,
unsigned long arg, u8 *arg_mask __maybe_unused)
{
int whence = arg;

switch (whence) {
#define P_WHENCE(n) case SEEK_##n: return scnprintf(bf, size, #n)
P_WHENCE(SET);
P_WHENCE(CUR);
P_WHENCE(END);
#ifdef SEEK_DATA
P_WHENCE(DATA);
#endif
#ifdef SEEK_HOLE
P_WHENCE(HOLE);
#endif
#undef P_WHENCE
default: break;
}

return scnprintf(bf, size, "%#x", whence);
}

#define SCA_WHENCE syscall_arg__scnprintf_whence

static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size,
unsigned long arg, u8 *arg_mask __maybe_unused)
{
Expand Down Expand Up @@ -201,6 +226,8 @@ static struct syscall_fmt {
.arg_scnprintf = { [1] = SCA_FUTEX_OP, /* op */ }, },
{ .name = "ioctl", .errmsg = true,
.arg_scnprintf = { [2] = SCA_HEX, /* arg */ }, },
{ .name = "lseek", .errmsg = true,
.arg_scnprintf = { [2] = SCA_WHENCE, /* whence */ }, },
{ .name = "lstat", .errmsg = true, .alias = "newlstat", },
{ .name = "madvise", .errmsg = true,
.arg_scnprintf = { [0] = SCA_HEX, /* start */
Expand Down

0 comments on commit 579e786

Please sign in to comment.