Messages in this thread | | | From | Namhyung Kim <> | Date | Wed, 15 Dec 2021 10:15:48 -0800 | Subject | Re: [PATCH 4/5] perf ftrace: Add -b/--use-bpf option for latency subcommand |
| |
On Mon, Dec 6, 2021 at 9:16 AM Namhyung Kim <namhyung@kernel.org> wrote: > > Hello Athira, > > On Sun, Dec 5, 2021 at 6:24 PM Athira Rajeev > <atrajeev@linux.vnet.ibm.com> wrote: > > > > > > > > > On 30-Nov-2021, at 4:48 AM, Namhyung Kim <namhyung@kernel.org> 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@kernel.org> > > > --- > [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.
Well, now we build perf with BPF by default. So I think it's ok to follow your suggestion. it'd show the usage and options when the -b option is used and BPF support is not enabled.
Thanks, Namhyung
| |