[v8,perf,bpf,10/15] perf-top: add option --no-bpf-event
diff mbox series

Message ID 20190311195555.889995-11-songliubraving@fb.com
State Not Applicable
Delegated to: BPF Maintainers
Headers show
Series
  • perf annotation of BPF programs
Related show

Commit Message

Song Liu March 11, 2019, 7:55 p.m. UTC
bpf events should be tracked by default for perf-top. This patch makes it
on by default, and adds option to disable bpf events.

Signed-off-by: Song Liu <songliubraving@fb.com>
---
 tools/perf/builtin-top.c | 3 +++
 tools/perf/util/top.h    | 1 +
 2 files changed, 4 insertions(+)

Comments

Song Liu March 11, 2019, 9:07 p.m. UTC | #1
> On Mar 11, 2019, at 12:55 PM, Song Liu <songliubraving@fb.com> wrote:
> 
> bpf events should be tracked by default for perf-top. This patch makes it
> on by default, and adds option to disable bpf events.
> 
> Signed-off-by: Song Liu <songliubraving@fb.com>
> ---
> tools/perf/builtin-top.c | 3 +++
> tools/perf/util/top.h    | 1 +
> 2 files changed, 4 insertions(+)
> 
> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> index 27d8d42e0a4d..ccdf5689452f 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, "no-bpf-event", &top.no_bpf_event, "do not 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",
> @@ -1651,6 +1652,8 @@ int cmd_top(int argc, const char **argv)
> 		signal(SIGWINCH, winch_sig);
> 	}
> 
> +	top.record_opts.bpf_event = !top.no_bpf_event;
> +
> 	status = __cmd_top(&top);
> 
> out_delete_evlist:
> diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h
> index 19f95eaf75c8..862a37bd27ea 100644
> --- a/tools/perf/util/top.h
> +++ b/tools/perf/util/top.h
> @@ -32,6 +32,7 @@ struct perf_top {
> 	bool		   use_tui, use_stdio;
> 	bool		   vmlinux_warned;
> 	bool		   dump_symtab;
> +	bool		   no_bpf_event;
> 	struct hist_entry  *sym_filter_entry;
> 	struct perf_evsel  *sym_evsel;
> 	struct perf_session *session;
> -- 
> 2.17.1
> 

Hi Arnaldo, 

Currently, we have bpf-event default OFF for perf-record, with option to 
turn it ON; while bpf-event is default ON for perf-top, with option to 
turn if OFF. I think this is a little confusing. 

How about we set them both to default ON, and add option to turn it OFF?
I think we still have time to make the change. 

Thanks,
Song
Arnaldo Carvalho de Melo March 11, 2019, 9:17 p.m. UTC | #2
Em Mon, Mar 11, 2019 at 09:07:20PM +0000, Song Liu escreveu:
> 
> 
> > On Mar 11, 2019, at 12:55 PM, Song Liu <songliubraving@fb.com> wrote:
> > 
> > bpf events should be tracked by default for perf-top. This patch makes it
> > on by default, and adds option to disable bpf events.
> > 
> > Signed-off-by: Song Liu <songliubraving@fb.com>
> > ---
> > tools/perf/builtin-top.c | 3 +++
> > tools/perf/util/top.h    | 1 +
> > 2 files changed, 4 insertions(+)
> > 
> > diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> > index 27d8d42e0a4d..ccdf5689452f 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, "no-bpf-event", &top.no_bpf_event, "do not 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",
> > @@ -1651,6 +1652,8 @@ int cmd_top(int argc, const char **argv)
> > 		signal(SIGWINCH, winch_sig);
> > 	}
> > 
> > +	top.record_opts.bpf_event = !top.no_bpf_event;
> > +
> > 	status = __cmd_top(&top);
> > 
> > out_delete_evlist:
> > diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h
> > index 19f95eaf75c8..862a37bd27ea 100644
> > --- a/tools/perf/util/top.h
> > +++ b/tools/perf/util/top.h
> > @@ -32,6 +32,7 @@ struct perf_top {
> > 	bool		   use_tui, use_stdio;
> > 	bool		   vmlinux_warned;
> > 	bool		   dump_symtab;
> > +	bool		   no_bpf_event;
> > 	struct hist_entry  *sym_filter_entry;
> > 	struct perf_evsel  *sym_evsel;
> > 	struct perf_session *session;
> > -- 
> > 2.17.1
> > 
> 
> Hi Arnaldo, 
> 
> Currently, we have bpf-event default OFF for perf-record, with option to 
> turn it ON; while bpf-event is default ON for perf-top, with option to 
> turn if OFF. I think this is a little confusing. 
> 
> How about we set them both to default ON, and add option to turn it OFF?

Agreed.

> I think we still have time to make the change. 
> 
> Thanks,
> Song
> 
>

Patch
diff mbox series

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 27d8d42e0a4d..ccdf5689452f 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, "no-bpf-event", &top.no_bpf_event, "do not 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",
@@ -1651,6 +1652,8 @@  int cmd_top(int argc, const char **argv)
 		signal(SIGWINCH, winch_sig);
 	}
 
+	top.record_opts.bpf_event = !top.no_bpf_event;
+
 	status = __cmd_top(&top);
 
 out_delete_evlist:
diff --git a/tools/perf/util/top.h b/tools/perf/util/top.h
index 19f95eaf75c8..862a37bd27ea 100644
--- a/tools/perf/util/top.h
+++ b/tools/perf/util/top.h
@@ -32,6 +32,7 @@  struct perf_top {
 	bool		   use_tui, use_stdio;
 	bool		   vmlinux_warned;
 	bool		   dump_symtab;
+	bool		   no_bpf_event;
 	struct hist_entry  *sym_filter_entry;
 	struct perf_evsel  *sym_evsel;
 	struct perf_session *session;