Re: [PATCH 4/5] perf ftrace: Add -b/--use-bpf option for latency subcommand

From: Namhyung Kim
Date: Mon Dec 06 2021 - 12:16:33 EST


Hello Athira,

On Sun, Dec 5, 2021 at 6:24 PM Athira Rajeev
<atrajeev@xxxxxxxxxxxxxxxxxx> wrote:
>
>
>
> > On 30-Nov-2021, at 4:48 AM, Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> >
> > The -b/--use-bpf option is to use BPF to get latency info of kernel
> > functions. It'd have better performance impact and I observed that
> > latency of same function is smaller than before when using BPF.
> >
> > Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> > ---
[SNIP]
> > @@ -1144,6 +1166,8 @@ int cmd_ftrace(int argc, const char **argv)
> > const struct option latency_options[] = {
> > OPT_CALLBACK('T', "trace-funcs", &ftrace.filters, "func",
> > "Show latency of given function", parse_filter_func),
> > + OPT_BOOLEAN('b', "use-bpf", &ftrace.target.use_bpf,
> > + "Use BPF to measure function latency"),
>
>
> Hi Namhyung,
>
> Can this be inside BPF_SKEL check, similar to how we have “bpf-prog” and other options in builtin-stat.c ?
>
> #ifdef HAVE_BPF_SKEL
> <<OPT_BOOLEAN for use-bpf>>
> #endif
>
> Otherwise when using “-b” and if perf is not built with BPF_SKEL, we will just return in perf_ftrace__latency_prepare_bpf without any error messages.

Thanks for reporting this. Yeah, it should report
error messages in such conditions.

I think it'd be better to add an error message
rather than hiding the option.

Thanks,
Namhyung