Skip to content

perf trace: Better -p support

Howard Chu linux-perf-users lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2perf trace: Collect data only for certain pidstools/perf/builtin-trace.c tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c+64 -40 replies
2/2perf trace: Use pid to index perf_event in BPFtools/perf/builtin-trace.c tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c tools/perf/util/evlist.c+72 -180 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/2] perf trace: Better -p support

Currently we don't support only collecting data for certain pids in perf trace. We either collect nothing or everything.

Another thing is when using -p, becausing it's a per-pid mmap, bpf_perf_event_output will fail under current per-cpu only configuration. But since I fixed the -p problem already in the perf trace augmentation v3 patch series, this method will be an optimization instead of an actually bug fix.

!! Note that this patch series should be applied on top of the perf trace v3 patch series.

Before:
perf $ perf trace -e open -p 79768

         ? (         ):  ... [continued]: open())                                             = -1 ENOENT (No such file or directory)
         ? (         ):  ... [continued]: open())                                             = -1 ENOENT (No such file or directory)
         ? (         ):  ... [continued]: open())                                             = -1 ENOENT (No such file or directory)

After:
perf $ ./perf trace -e open -p 79768

     0.000 ( 0.019 ms): open(filename: "DINGZHEN", flags: WRONLY)                             = -1 ENOENT (No such file or directory)
  1000.187 ( 0.031 ms): open(filename: "DINGZHEN", flags: WRONLY)                             = -1 ENOENT (No such file or directory)
  2000.377 ( 0.019 ms): open(filename: "DINGZHEN", flags: WRONLY)                             = -1 ENOENT (No such file or directory)

Howard Chu (2):
perf trace: Collect data only for certain pids
perf trace: Use pid to index perf_event in BPF

 tools/perf/builtin-trace.c                    | 100 ++++++++++++++++--
 .../bpf_skel/augmented_raw_syscalls.bpf.c     |  54 ++++++++--
 tools/perf/util/evlist.c                      |   2 +-
 3 files changed, 135 insertions(+), 21 deletions(-)
Signature · 1 line
2.46.0