perf ui browser annotate: Show in the title the source code view toggle
Ingo reported that having a visual cue if the source code view is enabled will help in noticing a bug when no source is presented. Change the title scnprintf routine for the annotation browser to do that. More work is needed to have the capabilities of the existing disassemblers listed somehow and start using the fastest one but switch to another that provides features only made available by some particular one, like the first one, the objdump output parsing one. 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>
This commit is contained in:
@@ -704,6 +704,14 @@ switch_percent_type(struct annotation_options *opts, bool base)
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
static int annotate_browser__run(struct annotate_browser *browser,
|
||||
struct evsel *evsel,
|
||||
struct hist_browser_timer *hbt)
|
||||
@@ -719,7 +727,7 @@ static int annotate_browser__run(struct annotate_browser *browser,
|
||||
char title[256];
|
||||
int key;
|
||||
|
||||
hists__scnprintf_title(hists, title, sizeof(title));
|
||||
annotate__scnprintf_title(hists, title, sizeof(title));
|
||||
if (annotate_browser__show(&browser->b, title, help) < 0)
|
||||
return -1;
|
||||
|
||||
@@ -755,7 +763,7 @@ static int annotate_browser__run(struct annotate_browser *browser,
|
||||
|
||||
if (delay_secs != 0) {
|
||||
symbol__annotate_decay_histogram(sym, evsel);
|
||||
hists__scnprintf_title(hists, title, sizeof(title));
|
||||
annotate__scnprintf_title(hists, title, sizeof(title));
|
||||
annotate_browser__show(&browser->b, title, help);
|
||||
}
|
||||
continue;
|
||||
@@ -820,6 +828,8 @@ static int annotate_browser__run(struct annotate_browser *browser,
|
||||
case 's':
|
||||
if (annotate_browser__toggle_source(browser))
|
||||
ui_helpline__puts(help);
|
||||
annotate__scnprintf_title(hists, title, sizeof(title));
|
||||
annotate_browser__show(&browser->b, title, help);
|
||||
continue;
|
||||
case 'o':
|
||||
annotate_opts.use_offset = !annotate_opts.use_offset;
|
||||
@@ -906,7 +916,7 @@ show_sup_ins:
|
||||
case 'p':
|
||||
case 'b':
|
||||
switch_percent_type(&annotate_opts, key == 'b');
|
||||
hists__scnprintf_title(hists, title, sizeof(title));
|
||||
annotate__scnprintf_title(hists, title, sizeof(title));
|
||||
annotate_browser__show(&browser->b, title, help);
|
||||
continue;
|
||||
case 'B':
|
||||
|
||||
Reference in New Issue
Block a user