• Arnaldo Carvalho de Melo's avatar
    perf trace: Use beautifiers on syscalls:sys_enter_ handlers · a98392bb
    Arnaldo Carvalho de Melo authored
    We were using the beautifiers only when processing the
    raw_syscalls:sys_enter events, but we can as well use them for the
    syscalls:sys_enter_NAME events, as the layout is the same.
    
    Some more tweaking is needed as we're processing them straight away,
    i.e. there is no buffering in the sys_enter_NAME event to wait for
    things like vfs_getname to provide pointer contents and then flushing
    at sys_exit_NAME, so we need to state in the syscall_arg that this
    is unbuffered, just print the pointer values, beautifying just
    non-pointer syscall args.
    
    This just shows an alternative way of processing tracepoints, that we
    will end up using when creating "tracepoint" payloads that already copy
    pointer contents (or chunks of it, i.e. not the whole filename, but just
    the end of it, not all the bf for a read/write, but just the start,
    etc), directly in the kernel using eBPF.
    
    E.g.:
    
      # perf trace -e syscalls:*enter*sleep,*sleep sleep 1
         0.303 (         ): syscalls:sys_enter_nanosleep:rqtp: 0x7ffc93d5ecc0
         0.305 (1000.229 ms): sleep/8746 nanosleep(rqtp: 0x7ffc93d5ecc0) = 0
      # perf trace -e syscalls:*_*sleep,*sleep sleep 1
         0.288 (         ): syscalls:sys_enter_nanosleep:rqtp: 0x7ffecde87e40
         0.289 (         ): sleep/8748 nanosleep(rqtp: 0x7ffecde87e40) ...
      1000.479 (         ): syscalls:sys_exit_nanosleep:0x0
         0.289 (1000.208 ms): sleep/8748  ... [continued]: nanosleep()) = 0
      #
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: https://lkml.kernel.org/n/tip-jehyd2zwhw00z3p7v7mg9632@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    a98392bb
builtin-trace.c 91 KB