Re: [PATCH v4 bpf-next 1/4] bpftool: introduce "prog profile" command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Mar 4, 2020, at 11:21 AM, Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
> 
> On Wed, Mar 04, 2020 at 10:07:07AM -0800, Song Liu wrote:
>> With fentry/fexit programs, it is possible to profile BPF program with
>> hardware counters. Introduce bpftool "prog profile", which measures key
>> metrics of a BPF program.
>> 
>> bpftool prog profile command creates per-cpu perf events. Then it attaches
>> fentry/fexit programs to the target BPF program. The fentry program saves
>> perf event value to a map. The fexit program reads the perf event again,
>> and calculates the difference, which is the instructions/cycles used by
>> the target program.
>> 
>> Example input and output:
>> 
>>  ./bpftool prog profile id 337 duration 3 cycles instructions llc_misses
>> 
>>        4228 run_cnt
>>     3403698 cycles                                              (84.08%)
>>     3525294 instructions   #  1.04 insn per cycle               (84.05%)
>>          13 llc_misses     #  3.69 LLC misses per million isns  (83.50%)
> 
> FYI I'm in the middle of moving perf's 'events parsing' interface to libperf,
> which takes event name/s on input and returns list of perf_event_attr objects
> 
>  parse_events("cycles") -> ready to use 'struct perf_event_attr'
> 
> You can use any event that's listed in 'perf list' command, which includes
> also all vendor (Intel/Arm/ppc..) events. It might be useful extension for
> this command.

That's great news! Thanks for the information!

Song





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux