Skip to contentSkip to conversation

perf hists browser: Allow passing an initial hotkey

tip: perf/core tip-bot2 for Arnaldo Carvalho de Melo 1 participant 1 message Jan 10, 2020 1 message not in the archive perf events

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

tip-bot2 for Arnaldo Carvalho de Melo

author merge bot Applied
#1 lore raw

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     d10ec006dcd7b20b2eb7e9ef32fc6f83b0112893
Gitweb:        https://git.kernel.org/tip/d10ec006dcd7b20b2eb7e9ef32fc6f83b0112893
Author:        Arnaldo Carvalho de Melo <[email protected]>
AuthorDate:    Thu, 12 Dec 2019 15:31:40 -03:00
Committer:     Arnaldo Carvalho de Melo <[email protected]>
CommitterDate: Mon, 06 Jan 2020 11:46:10 -03:00

perf hists browser: Allow passing an initial hotkey

Sometimes we're in an outer code, like the main hists browser popup menu and the user follows a suggestion about using some hotkey, and that hotkey is really handled by hists_browser__run(), so allow for calling it with that hotkey, making it handle it instead of waiting for the user to press one.

---
 tools/perf/builtin-c2c.c       |   4 +-
 tools/perf/ui/browsers/hists.c | 153 ++++++++++++++++----------------
 tools/perf/ui/browsers/hists.h |   2 +-
 3 files changed, 82 insertions(+), 77 deletions(-)
tools/perf/builtin-c2c.c +2 -2
index e69f449..3463512 100644
@@ -2384,7 +2384,7 @@ static int perf_c2c__browse_cacheline(struct hist_entry *he)
 	c2c_browser__update_nr_entries(browser);
 
 	while (1) {
-		key = hist_browser__run(browser, "? - help", true);
+		key = hist_browser__run(browser, "? - help", true, 0);
 
 		switch (key) {
 		case 's':
@@ -2453,7 +2453,7 @@ static int perf_c2c__hists_browse(struct hists *hists)
 	c2c_browser__update_nr_entries(browser);
 
 	while (1) {
-		key = hist_browser__run(browser, "? - help", true);
+		key = hist_browser__run(browser, "? - help", true, 0);
 
 		switch (key) {
 		case 'q':
tools/perf/ui/browsers/hists.c +79 -74

183 lines not on this page · raw message

tools/perf/ui/browsers/hists.h +1 -1
index 078f2f2..1e938d9 100644
@@ -34,7 +34,7 @@ struct hist_browser {
 struct hist_browser *hist_browser__new(struct hists *hists);
 void hist_browser__delete(struct hist_browser *browser);
 int hist_browser__run(struct hist_browser *browser, const char *help,
-		      bool warn_lost_event);
+		      bool warn_lost_event, int key);
 void hist_browser__init(struct hist_browser *browser,
 			struct hists *hists);
 #endif /* _PERF_UI_BROWSER_HISTS_H_ */