[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201201073647.753079-1-songliubraving@fb.com>
Date: Mon, 30 Nov 2020 23:36:45 -0800
From: Song Liu <songliubraving@...com>
To: <linux-kernel@...r.kernel.org>
CC: <kernel-team@...com>, <peterz@...radead.org>, <mingo@...hat.com>,
<acme@...nel.org>, <mark.rutland@....com>,
<alexander.shishkin@...ux.intel.com>, <jolsa@...hat.com>,
<namhyung@...nel.org>, Song Liu <songliubraving@...com>
Subject: [RFC v2 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.
Sending as RFC because I haven't addressed some known limitations:
1. Only counting events for one BPF program at a time.
2. Need extra logic in target__validate().
Changes RFCv1 => RFCv2:
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 | 3 +-
tools/perf/Makefile.config | 9 +
tools/perf/Makefile.perf | 52 ++++-
tools/perf/builtin-stat.c | 59 ++++-
tools/perf/util/Build | 1 +
tools/perf/util/bpf_counter.c | 215 ++++++++++++++++++
tools/perf/util/bpf_counter.h | 71 ++++++
tools/perf/util/bpf_skel/.gitignore | 3 +
.../util/bpf_skel/bpf_prog_profiler.bpf.c | 96 ++++++++
tools/perf/util/bpf_skel/dummy.bpf.c | 19 ++
tools/perf/util/evsel.c | 10 +
tools/perf/util/evsel.h | 5 +
tools/perf/util/target.h | 6 +
tools/scripts/Makefile.include | 1 +
15 files changed, 541 insertions(+), 11 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
create mode 100644 tools/perf/util/bpf_skel/dummy.bpf.c
--
2.24.1
Powered by blists - more mailing lists