Skip to content

Commit 1d4374a

Browse files
namhyungacmel
authored andcommitted
perf annotate: Add 'T' hot key to toggle data type display
Support data type display with a key press so that users can toggle the output dynamically on TUI. Also display "[Type]" in the title line if it's enabled. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20250816031635.25318-9-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 7dbe89c commit 1d4374a

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

tools/perf/ui/browsers/annotate.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,10 @@ static void ui_browser__init_asm_mode(struct ui_browser *browser)
533533
static int sym_title(struct symbol *sym, struct map *map, char *title,
534534
size_t sz, int percent_type)
535535
{
536-
return snprintf(title, sz, "%s %s [Percent: %s]", sym->name,
536+
return snprintf(title, sz, "%s %s [Percent: %s] %s", sym->name,
537537
dso__long_name(map__dso(map)),
538-
percent_type_str(percent_type));
538+
percent_type_str(percent_type),
539+
annotate_opts.code_with_type ? "[Type]" : "");
539540
}
540541

541542
/*
@@ -909,7 +910,8 @@ static int annotate_browser__run(struct annotate_browser *browser,
909910
"b Toggle percent base [period/hits]\n"
910911
"B Branch counter abbr list (Optional)\n"
911912
"? Search string backwards\n"
912-
"f Toggle showing offsets to full address\n");
913+
"f Toggle showing offsets to full address\n"
914+
"T Toggle data type display\n");
913915
continue;
914916
case 'r':
915917
script_browse(NULL, NULL);
@@ -1029,6 +1031,12 @@ static int annotate_browser__run(struct annotate_browser *browser,
10291031
case 'f':
10301032
annotation__toggle_full_addr(notes, ms);
10311033
continue;
1034+
case 'T':
1035+
annotate_opts.code_with_type ^= 1;
1036+
if (browser->dbg == NULL)
1037+
browser->dbg = debuginfo__new(dso__long_name(map__dso(ms->map)));
1038+
annotate_browser__show(&browser->b, title, help);
1039+
continue;
10321040
case K_LEFT:
10331041
case '<':
10341042
case '>':
@@ -1133,8 +1141,7 @@ int __hist_entry__tui_annotate(struct hist_entry *he, struct map_symbol *ms,
11331141

11341142
ret = annotate_browser__run(&browser, evsel, hbt);
11351143

1136-
if (annotate_opts.code_with_type)
1137-
debuginfo__delete(browser.dbg);
1144+
debuginfo__delete(browser.dbg);
11381145
if (not_annotated && !notes->src->tried_source)
11391146
annotated_source__purge(notes->src);
11401147

0 commit comments

Comments
 (0)