Messages in this thread |  | | From | Song Liu <> | Subject | Re: [PATCH v6 2/4] perf: support build BPF skeletons with perf | Date | Tue, 29 Dec 2020 17:14:12 +0000 |
| |
> On Dec 29, 2020, at 3:48 AM, Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > > Em Tue, Dec 29, 2020 at 04:01:41PM +0900, Namhyung Kim escreveu: >> On Tue, Dec 29, 2020 at 2:41 AM Song Liu <songliubraving@fb.com> wrote: >>> BPF programs are useful in perf to profile BPF programs. BPF skeleton is > >> I'm having difficulties understanding the first sentence - looks like a >> recursion. :) So do you want to use two (or more) BPF programs? > > Yeah, we use perf to perf perf, so we need to use bpf with perf to perf > bpf :-) > > Look at tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c, the BPF > skeleton used to create the in-kernel scaffold to profile BPF programs. > > It uses two BPF programs (fentry/XXX and fexit/XXX) and some a > PERF_EVENT_ARRAY map and an array to diff counters read at exit from > counters read at exit of the profiled BPF programs and then accumulate > those diffs in another PERCPU_ARRAY. > > This all ends up composing a "BPF PMU" that is what the userspace perf > tooling will read (from "accum_readings" BPF map) and 'perf stat' will > consume as if reading from an "old style perf counter" :-) > > Song, did I get it right? :-)
Thanks Arnaldo! I don't think anyone can explain it better. :-)
Song
[...]
|  |