• Hari Bathini's avatar
    perf script: Add script print support for namespace events · 96a44bbc
    Hari Bathini authored
    Introduce a new option to display events of type PERF_RECORD_NAMESPACES
    and update perf-script documentation accordingly.
    
    Shown below is output (trimmed) of perf script command with the newly
    introduced option, on perf.data generated with perf record command using
    --namespaces option.
    
      $ perf script --show-namespace-events
          swapper   0 [000]     0.000000: PERF_RECORD_NAMESPACES 1/1 - nr_namespaces: 7
                    [0/net: 3/0xf000001c, 1/uts: 3/0xeffffffe, 2/ipc: 3/0xefffffff, 3/pid: 3/0xeffffffc,
                     4/user: 3/0xeffffffd, 5/mnt: 3/0xf0000000, 6/cgroup: 3/0xeffffffb]
          swapper   0 [000]     0.000000: PERF_RECORD_NAMESPACES 2/2 - nr_namespaces: 7
                    [0/net: 3/0xf000001c, 1/uts: 3/0xeffffffe, 2/ipc: 3/0xefffffff, 3/pid: 3/0xeffffffc,
                     4/user: 3/0xeffffffd, 5/mnt: 3/0xf0000000, 6/cgroup: 3/0xeffffffb]
    
    Commiter notes:
    
    Testing it:
    
    Investigating that double PERF_RECORD_NAMESPACES for the 19155
    pid/tid... Its more than that, there are two PERF_RECORD_COMM as well,
    and with zeroed timestamps, so probably a synthesizing artifact...
    
      # perf script --show-task --show-namespace
      <SNIP>
          perf     0 [000]     0.000000: PERF_RECORD_COMM: perf:19154/19154
          perf     0 [000]     0.000000: PERF_RECORD_FORK(19155:19155):(19154:19154)
          perf     0 [000]     0.000000: PERF_RECORD_NAMESPACES 19155/19155 - nr_namespaces: 7
              [0/net: 3/0xf0000081, 1/uts: 3/0xeffffffe, 2/ipc: 3/0xefffffff, 3/pid: 3/0xeffffffc,
               4/user: 3/0xeffffffd, 5/mnt: 3/0xf0000000, 6/cgroup: 3/0xeffffffb]
          perf     0 [000]     0.000000: PERF_RECORD_COMM: perf:19155/19155
          perf     0 [000]     0.000000: PERF_RECORD_COMM: perf:19155/19155
          perf     0 [000]     0.000000: PERF_RECORD_NAMESPACES 19155/19155 - nr_namespaces: 7
              [0/net: 3/0xf0000081, 1/uts: 3/0xeffffffe, 2/ipc: 3/0xefffffff, 3/pid: 3/0xeffffffc,
               4/user: 3/0xeffffffd, 5/mnt: 3/0xf0000000, 6/cgroup: 3/0xeffffffb]
       swapper     0 [000]  3110.881834:          1 cycles:  ffffffffa7060bf6 native_write_msr (/lib/modules/4.11.0-rc1+/build/vmlinux)
    
      <SNIP>
    Signed-off-by: default avatarHari Bathini <hbathini@linux.vnet.ibm.com>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Alexei Starovoitov <ast@fb.com>
    Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
    Cc: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
    Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
    Cc: Daniel Borkmann <daniel@iogearbox.net>
    Cc: Eric Biederman <ebiederm@xmission.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Sargun Dhillon <sargun@sargun.me>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Link: http://lkml.kernel.org/r/148891932627.25309.1941587059154176221.stgit@hbathini.in.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    96a44bbc
builtin-script.c 63.4 KB