perf ui browser annotate: Don't show the source code view status initially

To avoid initial clutter, and not to change the view users that are not
interested in toggling the source code view, just show it when the user
does the first toggle keypress (pressing 's').

I know that there are users that really disable the source code view by
using:

  # perf config annotate.hide_src_code=yes

Tested-by: Ingo Molnar <mingo@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
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>
This commit is contained in:
Arnaldo Carvalho de Melo
2025-04-08 19:22:09 -03:00
parent c6043d35c0
commit bf5ea13bae
3 changed files with 11 additions and 2 deletions

View File

@@ -406,6 +406,9 @@ static bool annotate_browser__toggle_source(struct annotate_browser *browser)
browser->b.index = al->idx_asm; browser->b.index = al->idx_asm;
} }
if (annotate_opts.hide_src_code_on_title)
annotate_opts.hide_src_code_on_title = false;
return true; return true;
} }
@@ -708,10 +711,14 @@ static int annotate__scnprintf_title(struct hists *hists, char *bf, size_t size)
{ {
int printed = hists__scnprintf_title(hists, bf, size); int printed = hists__scnprintf_title(hists, bf, size);
return printed + scnprintf(bf + printed, size - printed, " [source: %s]", if (!annotate_opts.hide_src_code_on_title) {
printed += scnprintf(bf + printed, size - printed, " [source: %s]",
annotate_opts.hide_src_code ? "OFF" : "On"); annotate_opts.hide_src_code ? "OFF" : "On");
} }
return printed;
}
static int annotate_browser__run(struct annotate_browser *browser, static int annotate_browser__run(struct annotate_browser *browser,
struct evsel *evsel, struct evsel *evsel,
struct hist_browser_timer *hbt) struct hist_browser_timer *hbt)

View File

@@ -2280,6 +2280,7 @@ void annotation_options__init(void)
opt->annotate_src = true; opt->annotate_src = true;
opt->offset_level = ANNOTATION__OFFSET_JUMP_TARGETS; opt->offset_level = ANNOTATION__OFFSET_JUMP_TARGETS;
opt->percent_type = PERCENT_PERIOD_LOCAL; opt->percent_type = PERCENT_PERIOD_LOCAL;
opt->hide_src_code_on_title = true;
} }
void annotation_options__exit(void) void annotation_options__exit(void)

View File

@@ -44,6 +44,7 @@ enum perf_disassembler {
struct annotation_options { struct annotation_options {
bool hide_src_code, bool hide_src_code,
hide_src_code_on_title,
use_offset, use_offset,
jump_arrows, jump_arrows,
print_lines, print_lines,