]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf ui browser annotate: Don't show the source code view status initially
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 8 Apr 2025 22:22:09 +0000 (19:22 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 10 Apr 2025 13:46:32 +0000 (10:46 -0300)
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>
tools/perf/ui/browsers/annotate.c
tools/perf/util/annotate.c
tools/perf/util/annotate.h

index a9338c071f5682516f190f853623c4c77350e075..ab776b1ed2d5b4ba6136315a23111ef23713f2b1 100644 (file)
@@ -406,6 +406,9 @@ static bool annotate_browser__toggle_source(struct annotate_browser *browser)
                browser->b.index = al->idx_asm;
        }
 
+       if (annotate_opts.hide_src_code_on_title)
+               annotate_opts.hide_src_code_on_title = false;
+
        return true;
 }
 
@@ -708,8 +711,12 @@ static int annotate__scnprintf_title(struct hists *hists, char *bf, size_t size)
 {
        int printed = hists__scnprintf_title(hists, bf, size);
 
-       return printed + scnprintf(bf + printed, size - printed, " [source: %s]",
-                                  annotate_opts.hide_src_code ? "OFF" : "On");
+       if (!annotate_opts.hide_src_code_on_title) {
+               printed += scnprintf(bf + printed, size - printed, " [source: %s]",
+                                    annotate_opts.hide_src_code ? "OFF" : "On");
+       }
+
+       return printed;
 }
 
 static int annotate_browser__run(struct annotate_browser *browser,
index 1e59b9e5339d393b26a9e64864cc5f5f2fa78202..264a212b47df850c2593177b5562e86d9b5d18b7 100644 (file)
@@ -2280,6 +2280,7 @@ void annotation_options__init(void)
        opt->annotate_src = true;
        opt->offset_level = ANNOTATION__OFFSET_JUMP_TARGETS;
        opt->percent_type = PERCENT_PERIOD_LOCAL;
+       opt->hide_src_code_on_title = true;
 }
 
 void annotation_options__exit(void)
index 0e6e3f60a897b850a1beb3b1c687b7974c4c734d..bbb89b32f398b3c9b23e3e6182cb57f67444e2aa 100644 (file)
@@ -44,6 +44,7 @@ enum perf_disassembler {
 
 struct annotation_options {
        bool hide_src_code,
+            hide_src_code_on_title,
             use_offset,
             jump_arrows,
             print_lines,