diff mbox series

[v2,perf,bpf,09/11] perf-top: add option --bpf-event

Message ID 20190215000010.2590505-8-songliubraving@fb.com
State Changes Requested
Delegated to: BPF Maintainers
Headers show
Series perf annotation of BPF programs | expand

Commit Message

Song Liu Feb. 15, 2019, midnight UTC
bpf events are only tracked when opts->bpf_event is enabled. This patch
adds command line flag to enable this for perf-top.

Signed-off-by: Song Liu <songliubraving@fb.com>
---
 tools/perf/builtin-top.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Arnaldo Carvalho de Melo Feb. 15, 2019, 2:27 p.m. UTC | #1
Em Thu, Feb 14, 2019 at 04:00:10PM -0800, Song Liu escreveu:
> bpf events are only tracked when opts->bpf_event is enabled. This patch
> adds command line flag to enable this for perf-top.

Shouldn't this start as enabled and we just provide a way to disable it
for testing purposes? Normally perf top works system wide, and then we
want to get info about BPF events, I think.

- Arnaldo
 
> Signed-off-by: Song Liu <songliubraving@fb.com>
> ---
>  tools/perf/builtin-top.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> index 27d8d42e0a4d..5271d7211b9c 100644
> --- a/tools/perf/builtin-top.c
> +++ b/tools/perf/builtin-top.c
> @@ -1492,6 +1492,7 @@ int cmd_top(int argc, const char **argv)
>  		    "Display raw encoding of assembly instructions (default)"),
>  	OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
>  		    "Enable kernel symbol demangling"),
> +	OPT_BOOLEAN(0, "bpf-event", &opts->bpf_event, "record bpf events"),
>  	OPT_STRING(0, "objdump", &top.annotation_opts.objdump_path, "path",
>  		    "objdump binary to use for disassembly and annotations"),
>  	OPT_STRING('M', "disassembler-style", &top.annotation_opts.disassembler_style, "disassembler style",
> -- 
> 2.17.1
Song Liu Feb. 15, 2019, 5:06 p.m. UTC | #2
> On Feb 15, 2019, at 6:27 AM, Arnaldo Carvalho de Melo <acme@redhat.com> wrote:
> 
> Em Thu, Feb 14, 2019 at 04:00:10PM -0800, Song Liu escreveu:
>> bpf events are only tracked when opts->bpf_event is enabled. This patch
>> adds command line flag to enable this for perf-top.
> 
> Shouldn't this start as enabled and we just provide a way to disable it
> for testing purposes? Normally perf top works system wide, and then we
> want to get info about BPF events, I think.
> 
> - Arnaldo

We can enable it by default, and add a --no-bpf-event option to disable it
for testing. 

Thanks,
Song



>> Signed-off-by: Song Liu <songliubraving@fb.com>
>> ---
>> tools/perf/builtin-top.c | 1 +
>> 1 file changed, 1 insertion(+)
>> 
>> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
>> index 27d8d42e0a4d..5271d7211b9c 100644
>> --- a/tools/perf/builtin-top.c
>> +++ b/tools/perf/builtin-top.c
>> @@ -1492,6 +1492,7 @@ int cmd_top(int argc, const char **argv)
>> 		    "Display raw encoding of assembly instructions (default)"),
>> 	OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
>> 		    "Enable kernel symbol demangling"),
>> +	OPT_BOOLEAN(0, "bpf-event", &opts->bpf_event, "record bpf events"),
>> 	OPT_STRING(0, "objdump", &top.annotation_opts.objdump_path, "path",
>> 		    "objdump binary to use for disassembly and annotations"),
>> 	OPT_STRING('M', "disassembler-style", &top.annotation_opts.disassembler_style, "disassembler style",
>> -- 
>> 2.17.1
Arnaldo Carvalho de Melo Feb. 15, 2019, 6:05 p.m. UTC | #3
Em Fri, Feb 15, 2019 at 05:06:19PM +0000, Song Liu escreveu:
> > On Feb 15, 2019, at 6:27 AM, Arnaldo Carvalho de Melo <acme@redhat.com> wrote:
> > Em Thu, Feb 14, 2019 at 04:00:10PM -0800, Song Liu escreveu:
> >> bpf events are only tracked when opts->bpf_event is enabled. This patch
> >> adds command line flag to enable this for perf-top.
 
> > Shouldn't this start as enabled and we just provide a way to disable it
> > for testing purposes? Normally perf top works system wide, and then we
> > want to get info about BPF events, I think.

> We can enable it by default, and add a --no-bpf-event option to disable it
> for testing. 

Excellent, thanks.

- Arnaldo
diff mbox series

Patch

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 27d8d42e0a4d..5271d7211b9c 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1492,6 +1492,7 @@  int cmd_top(int argc, const char **argv)
 		    "Display raw encoding of assembly instructions (default)"),
 	OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
 		    "Enable kernel symbol demangling"),
+	OPT_BOOLEAN(0, "bpf-event", &opts->bpf_event, "record bpf events"),
 	OPT_STRING(0, "objdump", &top.annotation_opts.objdump_path, "path",
 		    "objdump binary to use for disassembly and annotations"),
 	OPT_STRING('M', "disassembler-style", &top.annotation_opts.disassembler_style, "disassembler style",