[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201119045046.1491106-1-songliubraving@fb.com>
Date: Wed, 18 Nov 2020 20:50:44 -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 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 would like comments on some key design choices:
1. We are using BPF skeletons here, which is by far the easiest way to
write and ship BPF programs. However, this requires bpftool, which
makes building perf slower.
2. A Makefile is added to tools/perf/util/bpf_skel/ to build bpftool,
and BPF skeletons. This keeps main perf Makefiles simple. But we may
not like it for some reason?
Some known limitations (or work to be done):
1. Only counting events for one BPF program at a time.
2. Need extra logic in target__validate().
Song Liu (2):
perf: support build BPF skeletons with perf
perf-stat: enable counting events for BPF programs
tools/build/Makefile.feature | 3 +-
tools/perf/Makefile.config | 8 +
tools/perf/Makefile.perf | 15 +-
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 +
tools/perf/util/bpf_skel/Makefile | 71 ++++++
.../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 +
14 files changed, 571 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/Makefile
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