Re: [RFC 2/2] perf-stat: enable counting events for BPF programs
From: Jiri Olsa
Date: Wed Nov 25 2020 - 11:44:28 EST
On Wed, Nov 25, 2020 at 12:02:13AM +0000, Song Liu wrote:
>
>
> > On Nov 24, 2020, at 3:43 PM, Song Liu <songliubraving@xxxxxx> wrote:
> >
> >
> >
> >> On Nov 24, 2020, at 11:51 AM, Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
> >>
> >> On Wed, Nov 18, 2020 at 08:50:46PM -0800, Song Liu wrote:
> >>
> >> SNIP
> >>
> >>> +static int bpf_program_profiler__install_pe(struct evsel *evsel, int cpu,
> >>> + int fd)
> >>> +{
> >>> + struct bpf_prog_profiler_bpf *skel = evsel->bpf_counter.skel;
> >>> +
> >>> + return bpf_map_update_elem(bpf_map__fd(skel->maps.events),
> >>> + &cpu, &fd, BPF_ANY);
> >>> +}
> >>> +
> >>> +struct bpf_counter_ops bpf_program_profiler_ops = {
> >>> + .load = bpf_program_profiler__load,
> >>> + .enable = bpf_program_profiler__enable,
> >>> + .read = bpf_program_profiler__read,
> >>> + .destroy = bpf_program_profiler__destroy,
> >>> + .install_pe = bpf_program_profiler__install_pe,
> >>> +};
> >>
> >> hum, what's the point of this ops? you plan some other ops?
> >> we could just define stat callbacks right?
>
> Which callbacks do you mean here? I would like to try that as
> well.
I meant just to drop that ops struct and have load/enable/read..
functions called from stat code
jirka