Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf ui browser: Add a warn on unhandled hotkey helper

Will be used by the various browsers, looks like:

┌─Warning!───────────────────────────────────────────┐
29.15 │ 3c: cmpl $0x3,(%rbx) │ │
3.77 │ ↓ je 51 │'Ctrl+V' key not associated, use 'h' to see actions!│
16.59 │ movq 0x3b0(%rbx),%rdx │ │
30.65 │ movl 0x8(%rdx),%eax │ │
3.77 │ cmpl %eax,%edi │Press any key... │
0.25 │ ↓ jb 82 └────────────────────────────────────────────────────┘

Suggested-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Ingo Molnar <mingo@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/Z_TYux5fUg2pW-pF@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+9
+8
tools/perf/ui/browser.c
··· 233 233 return key; 234 234 } 235 235 236 + int ui_browser__warn_unhandled_hotkey(struct ui_browser *browser, int key, int timeout, const char *help) 237 + { 238 + char kname[32]; 239 + 240 + key_name(key, kname, sizeof(kname)); 241 + return ui_browser__warning(browser, timeout, "\n'%s' key not associated%s!\n", kname, help ?: ""); 242 + } 243 + 236 244 int ui_browser__help_window(struct ui_browser *browser, const char *text) 237 245 { 238 246 int key;
+1
tools/perf/ui/browser.h
··· 66 66 67 67 int ui_browser__warning(struct ui_browser *browser, int timeout, 68 68 const char *format, ...); 69 + int ui_browser__warn_unhandled_hotkey(struct ui_browser *browser, int key, int timeout, const char *help); 69 70 int ui_browser__help_window(struct ui_browser *browser, const char *text); 70 71 bool ui_browser__dialog_yesno(struct ui_browser *browser, const char *text); 71 72 int ui_browser__input_window(const char *title, const char *text, char *input,