Em Tue, Jan 12, 2021 at 04:35:14PM +0900, Namhyung Kim escreveu:
> Hi,
> 
> On Wed, Dec 30, 2020 at 6:42 AM Song Liu <[email protected]> wrote:
> >
> > Introduce perf-stat -b option, which counts events for BPF programs, like:
> >
> > [root@localhost ~]# ~/perf stat -e ref-cycles,cycles -b 254 -I 1000
> >      1.487903822            115,200      ref-cycles
> >      1.487903822             86,012      cycles
> >      2.489147029             80,560      ref-cycles
> >      2.489147029             73,784      cycles
> >      3.490341825             60,720      ref-cycles
> >      3.490341825             37,797      cycles
> >      4.491540887             37,120      ref-cycles
> >      4.491540887             31,963      cycles
> >
> > The example above counts cycles and ref-cycles of BPF program of id 254.
> > This is similar to bpftool-prog-profile command, but more flexible.
> >
> > perf-stat -b creates per-cpu perf_event and loads fentry/fexit BPF
> > programs (monitor-progs) to the target BPF program (target-prog). The
> > monitor-progs read perf_event before and after the target-prog, and
> > aggregate the difference in a BPF map. Then the user space reads data
> > from these maps.
> >
> > A new struct bpf_counter is introduced to provide common interface that
> > uses BPF programs/maps to count perf events.
> 
> Acked-by: Namhyung Kim <[email protected]>

Applied locally, testing now.

- Arnaldo

Reply via email to