Skip to contentSkip to conversation

perf annotate: Move the default annotate options to the library

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Mar 25, 2018 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  7f0b6fde3111aec82487662ccef5a4ebecb93381
Gitweb:     https://git.kernel.org/tip/7f0b6fde3111aec82487662ccef5a4ebecb93381
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Fri, 16 Mar 2018 14:33:38 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 21 Mar 2018 12:53:40 -0300

perf annotate: Move the default annotate options to the library

One more thing that goes from the TUI code to be used more widely, for instance it'll affect the default options used by:

  perf annotate --stdio2
---
 tools/perf/builtin-annotate.c     |  2 ++
 tools/perf/builtin-report.c       |  1 +
 tools/perf/builtin-top.c          |  2 ++
 tools/perf/ui/browser.c           |  2 --
 tools/perf/ui/browser.h           |  1 -
 tools/perf/ui/browsers/annotate.c | 67 +--------------------------------------
 tools/perf/util/annotate.c        | 62 ++++++++++++++++++++++++++++++++++++
 tools/perf/util/annotate.h        |  4 +++
 8 files changed, 72 insertions(+), 69 deletions(-)
tools/perf/builtin-annotate.c +2 -0
index e03f9bea9303..fd5aac3fd949 100644
@@ -572,6 +572,8 @@ int cmd_annotate(int argc, const char **argv)
 	if (ret < 0)
 		goto out_delete;
 
+	annotation_config__init();
+
 	symbol_conf.try_vmlinux_path = true;
 
 	ret = symbol__init(&annotate.session->header.env);
tools/perf/builtin-report.c +1 -0
index 91da12975642..1a82f38671a8 100644
@@ -1340,6 +1340,7 @@ repeat:
 			symbol_conf.priv_size += sizeof(u32);
 			symbol_conf.sort_by_name = true;
 		}
+		annotation_config__init();
 	}
 
 	if (symbol__init(&session->header.env) < 0)
tools/perf/builtin-top.c +2 -0
index 113c298ed38b..f39bd60d2708 100644
@@ -1493,6 +1493,8 @@ int cmd_top(int argc, const char **argv)
 	if (status < 0)
 		goto out_delete_evlist;
 
+	annotation_config__init();
+
 	symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
 	if (symbol__init(NULL) < 0)
 		return -1;
tools/perf/ui/browser.c +0 -2
index 33c30325885f..9f6ce29b83b4 100644
@@ -784,6 +784,4 @@ void ui_browser__init(void)
 		struct ui_browser_colorset *c = &ui_browser__colorsets[i++];
 		sltt_set_color(c->colorset, c->name, c->fg, c->bg);
 	}
-
-	annotate_browser__init();
 }
tools/perf/ui/browser.h +0 -1
index 9e69c6a43514..70057178ee34 100644
@@ -79,5 +79,4 @@ void ui_browser__list_head_seek(struct ui_browser *browser, off_t offset, int wh
 unsigned int ui_browser__list_head_refresh(struct ui_browser *browser);
 
 void ui_browser__init(void);
-void annotate_browser__init(void);
 #endif /* _PERF_UI_BROWSER_H_ */
tools/perf/ui/browsers/annotate.c +1 -66

94 lines not on this page · raw message

tools/perf/util/annotate.c +62 -0

77 lines not on this page · raw message

tools/perf/util/annotate.h +4 -0
index cf32cbc87930..3faa58045b22 100644
@@ -71,6 +71,8 @@ struct annotation_options {
 	     show_total_period;
 };
 
+extern struct annotation_options annotation__default_options;
+
 struct annotation;
 
 struct sym_hist_entry {
@@ -313,4 +315,6 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,
 
 extern const char	*disassembler_style;
 
+void annotation_config__init(void);
+
 #endif	/* __PERF_ANNOTATE_H */