Skip to content

Introduce perf-stat -b for BPF programs

Song Liu lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 4 repliesIn review

Changes in v1 from the cover letter

1. Support counting on multiple BPF programs.
2. Add BPF handling to target__validate().
3. Improve Makefile. (Jiri)

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2perf: support build BPF skeletons with perftools/bpf/bpftool/Makefile tools/build/Makefile.feature tools/perf/Makefile.config +4 more+82 -32 replies
2/2perf-stat: enable counting events for BPF programstools/perf/Makefile.perf tools/perf/builtin-stat.c tools/perf/util/Build +9 more+574 -332 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] Introduce perf-stat -b for BPF programs

This set introduces perf-stat -b option to count events for BPF programs. This is similar to bpftool-prog-profile. But perf-stat makes it much more flexible.

Changes RFC v2 => PATCH v1:
1. Support counting on multiple BPF programs.
2. Add BPF handling to target__validate().
3. Improve Makefile. (Jiri)

Changes RFC v1 => RFC v2:
1. Use bootstrap version of bpftool. (Jiri)
2. Set default to not building bpf skeletons. (Jiri)
3. Remove util/bpf_skel/Makefile, keep all the logic in Makefile.perf.

     (Jiri)

4. Remove dependency to vmlinux.h in the two skeletons. The goal here is to enable building perf without building kernel (vmlinux) first.
Note: I also removed the logic that build vmlinux.h. We can add that back when we have to use it (to access big kernel structures).

Song Liu (2):
perf: support build BPF skeletons with perf
perf-stat: enable counting events for BPF programs

 tools/bpf/bpftool/Makefile                    |   2 +
 tools/build/Makefile.feature                  |   4 +-
 tools/perf/Makefile.config                    |  10 +
 tools/perf/Makefile.perf                      |  46 ++-
 tools/perf/builtin-stat.c                     |  70 ++++-
 tools/perf/util/Build                         |   1 +
 tools/perf/util/bpf_counter.c                 | 281 ++++++++++++++++++
 tools/perf/util/bpf_counter.h                 |  73 +++++
 tools/perf/util/bpf_skel/.gitignore           |   3 +
 .../util/bpf_skel/bpf_prog_profiler.bpf.c     |  96 ++++++
 tools/perf/util/evsel.c                       |  11 +
 tools/perf/util/evsel.h                       |   6 +
 tools/perf/util/stat-display.c                |   4 +-
 tools/perf/util/target.c                      |  34 ++-
 tools/perf/util/target.h                      |  10 +
 tools/scripts/Makefile.include                |   1 +
 16 files changed, 636 insertions(+), 16 deletions(-)
 create mode 100644 tools/perf/util/bpf_counter.c
 create mode 100644 tools/perf/util/bpf_counter.h
 create mode 100644 tools/perf/util/bpf_skel/.gitignore
 create mode 100644 tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c

--
2.24.1