[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <D54E47E1-AB6B-46C7-8139-3C43F3E316A8@fb.com>
Date: Wed, 4 Mar 2020 21:17:45 +0000
From: Song Liu <songliubraving@...com>
To: Jiri Olsa <jolsa@...hat.com>
CC: Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
"quentin@...valent.com" <quentin@...valent.com>,
Kernel Team <Kernel-team@...com>,
"ast@...nel.org" <ast@...nel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>,
"arnaldo.melo@...il.com" <arnaldo.melo@...il.com>,
"jolsa@...nel.org" <jolsa@...nel.org>
Subject: Re: [PATCH v4 bpf-next 1/4] bpftool: introduce "prog profile" command
> On Mar 4, 2020, at 11:21 AM, Jiri Olsa <jolsa@...hat.com> 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
Powered by blists - more mailing lists