[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <27D50788-0EFB-4A08-B3A0-F3C8642BEF69@fb.com>
Date: Sun, 1 Mar 2020 22:37:41 +0000
From: Song Liu <songliubraving@...com>
To: Yonghong Song <yhs@...com>
CC: Networking <netdev@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
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 v2 bpf-next 1/2] bpftool: introduce "prog profile" command
> On Feb 29, 2020, at 8:14 PM, Yonghong Song <yhs@...com> wrote:
>
>
>
> On 2/28/20 3:40 PM, 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 3 id 337 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%)
>
> if run_cnt is 0, the following is the result:
>
> -bash-4.4$ sudo ./bpftool prog profile 3 id 52 cycles instructions llc_misses
>
> 0 run_cnt
> 0 cycles
> 0 instructions # -nan insn per cycle
> 0 llc_misses # -nan LLC misses per million isns
>
> -nan is a little bit crypto for user output. maybe just says
> unknown insns per cycle
> in the comment?
>
> We can still display "0 cycles" etc. just to make output uniform.
Good catch! Will fix this in next version.
Song
Powered by blists - more mailing lists