lkml.org 
[lkml]   [2021]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v7 3/3] perf-stat: enable counting events for BPF programs
Hi,

On Wed, Dec 30, 2020 at 6:42 AM Song Liu <songliubraving@fb.com> 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 <namhyung@kernel.org>

Thanks,
Namhyung

\
 
 \ /
  Last update: 2021-01-12 08:39    [W:0.633 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site