* [PATCH 1/3] perf annotate: Fix signatue of annotate_browser__show()
@ 2025-09-08 6:10 Namhyung Kim
2025-09-08 6:10 ` [PATCH 2/3] perf annotate: Factor out annotate_browser__show_function_title() Namhyung Kim
2025-09-08 6:10 ` [PATCH 3/3] perf annotate: Fix title line after return from call Namhyung Kim
0 siblings, 2 replies; 3+ messages in thread
From: Namhyung Kim @ 2025-09-08 6:10 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, Kan Liang
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
According to the convention, the first argument should be
annotate_browser instead of ui_brwoser.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/ui/browsers/annotate.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index b770a8d4623ef1fb..6fd4c3483c5068ae 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -766,20 +766,21 @@ bool annotate_browser__continue_search_reverse(struct annotate_browser *browser,
return __annotate_browser__search_reverse(browser);
}
-static int annotate_browser__show(struct ui_browser *browser, char *title, const char *help)
+static int annotate_browser__show(struct annotate_browser *browser, char *title, const char *help)
{
- struct map_symbol *ms = browser->priv;
+ struct ui_browser *b = &browser->b;
+ struct map_symbol *ms = b->priv;
struct symbol *sym = ms->sym;
char symbol_dso[SYM_TITLE_MAX_SIZE];
- if (ui_browser__show(browser, title, help) < 0)
+ if (ui_browser__show(b, title, help) < 0)
return -1;
sym_title(sym, ms->map, symbol_dso, sizeof(symbol_dso), annotate_opts.percent_type);
- ui_browser__gotorc_title(browser, 0, 0);
- ui_browser__set_color(browser, HE_COLORSET_ROOT);
- ui_browser__write_nstring(browser, symbol_dso, browser->width + 1);
+ ui_browser__gotorc_title(b, 0, 0);
+ ui_browser__set_color(b, HE_COLORSET_ROOT);
+ ui_browser__write_nstring(b, symbol_dso, b->width + 1);
return 0;
}
@@ -858,7 +859,7 @@ static int annotate_browser__run(struct annotate_browser *browser,
int key;
annotate__scnprintf_title(hists, title, sizeof(title));
- if (annotate_browser__show(&browser->b, title, help) < 0)
+ if (annotate_browser__show(browser, title, help) < 0)
return -1;
annotate_browser__calc_percent(browser, evsel);
@@ -896,7 +897,7 @@ static int annotate_browser__run(struct annotate_browser *browser,
if (delay_secs != 0) {
symbol__annotate_decay_histogram(sym, evsel);
annotate__scnprintf_title(hists, title, sizeof(title));
- annotate_browser__show(&browser->b, title, help);
+ annotate_browser__show(browser, title, help);
}
continue;
case K_TAB:
@@ -947,7 +948,7 @@ static int annotate_browser__run(struct annotate_browser *browser,
continue;
case 'r':
script_browse(NULL, NULL);
- annotate_browser__show(&browser->b, title, help);
+ annotate_browser__show(browser, title, help);
continue;
case 'k':
annotate_opts.show_linenr = !annotate_opts.show_linenr;
@@ -962,7 +963,7 @@ static int annotate_browser__run(struct annotate_browser *browser,
if (annotate_browser__toggle_source(browser, evsel))
ui_helpline__puts(help);
annotate__scnprintf_title(hists, title, sizeof(title));
- annotate_browser__show(&browser->b, title, help);
+ annotate_browser__show(browser, title, help);
continue;
case 'o':
annotate_opts.use_offset = !annotate_opts.use_offset;
@@ -1050,7 +1051,7 @@ static int annotate_browser__run(struct annotate_browser *browser,
case 'b':
switch_percent_type(&annotate_opts, key == 'b');
annotate__scnprintf_title(hists, title, sizeof(title));
- annotate_browser__show(&browser->b, title, help);
+ annotate_browser__show(browser, title, help);
continue;
case 'B':
if (br_cntr_text)
@@ -1071,7 +1072,7 @@ static int annotate_browser__run(struct annotate_browser *browser,
browser->type_hash = hashmap__new(type_hash, type_equal,
/*ctx=*/NULL);
}
- annotate_browser__show(&browser->b, title, help);
+ annotate_browser__show(browser, title, help);
annotate_browser__debuginfo_warning(browser);
continue;
case K_LEFT:
--
2.51.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3] perf annotate: Factor out annotate_browser__show_function_title()
2025-09-08 6:10 [PATCH 1/3] perf annotate: Fix signatue of annotate_browser__show() Namhyung Kim
@ 2025-09-08 6:10 ` Namhyung Kim
2025-09-08 6:10 ` [PATCH 3/3] perf annotate: Fix title line after return from call Namhyung Kim
1 sibling, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2025-09-08 6:10 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, Kan Liang
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
It'll be used in other places.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/ui/browsers/annotate.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 6fd4c3483c5068ae..39f042837d438559 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -555,6 +555,20 @@ static int sym_title(struct symbol *sym, struct map *map, char *title,
annotate_opts.code_with_type ? "[Type]" : "");
}
+static void annotate_browser__show_function_title(struct annotate_browser *browser)
+{
+ struct ui_browser *b = &browser->b;
+ struct map_symbol *ms = b->priv;
+ struct symbol *sym = ms->sym;
+ char title[SYM_TITLE_MAX_SIZE];
+
+ sym_title(sym, ms->map, title, sizeof(title), annotate_opts.percent_type);
+
+ ui_browser__gotorc_title(b, 0, 0);
+ ui_browser__set_color(b, HE_COLORSET_ROOT);
+ ui_browser__write_nstring(b, title, b->width + 1);
+}
+
/*
* This can be called from external jumps, i.e. jumps from one function
* to another, like from the kernel's entry_SYSCALL_64 function to the
@@ -768,19 +782,10 @@ bool annotate_browser__continue_search_reverse(struct annotate_browser *browser,
static int annotate_browser__show(struct annotate_browser *browser, char *title, const char *help)
{
- struct ui_browser *b = &browser->b;
- struct map_symbol *ms = b->priv;
- struct symbol *sym = ms->sym;
- char symbol_dso[SYM_TITLE_MAX_SIZE];
-
- if (ui_browser__show(b, title, help) < 0)
+ if (ui_browser__show(&browser->b, title, help) < 0)
return -1;
- sym_title(sym, ms->map, symbol_dso, sizeof(symbol_dso), annotate_opts.percent_type);
-
- ui_browser__gotorc_title(b, 0, 0);
- ui_browser__set_color(b, HE_COLORSET_ROOT);
- ui_browser__write_nstring(b, symbol_dso, b->width + 1);
+ annotate_browser__show_function_title(browser);
return 0;
}
--
2.51.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/3] perf annotate: Fix title line after return from call
2025-09-08 6:10 [PATCH 1/3] perf annotate: Fix signatue of annotate_browser__show() Namhyung Kim
2025-09-08 6:10 ` [PATCH 2/3] perf annotate: Factor out annotate_browser__show_function_title() Namhyung Kim
@ 2025-09-08 6:10 ` Namhyung Kim
1 sibling, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2025-09-08 6:10 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, Kan Liang
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users
The second title line which shows symbol and DSO name is broken after
moving to another function at 'callq' instruction.
The ui_browser__show_title() is used for the first line which shows
global sample count and event name so it doesn't change across the
functions.
What it needs after processing 'call' instruction is to update the
second line onlly. Add a comment and call appropriate function.
You can verify the change by pressing ENTER on a 'call' instruction and
then ESC.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/ui/browsers/annotate.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 39f042837d438559..8fe699f985423eab 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -585,7 +585,6 @@ static bool annotate_browser__callq(struct annotate_browser *browser,
struct map_symbol *ms = browser->b.priv, target_ms;
struct disasm_line *dl = disasm_line(browser->selection);
struct annotation *notes;
- char title[SYM_TITLE_MAX_SIZE];
if (!dl->ops.target.sym) {
ui_helpline__puts("The called function was not found.");
@@ -607,8 +606,13 @@ static bool annotate_browser__callq(struct annotate_browser *browser,
target_ms.sym = dl->ops.target.sym;
annotation__unlock(notes);
__hist_entry__tui_annotate(browser->he, &target_ms, evsel, hbt);
- sym_title(ms->sym, ms->map, title, sizeof(title), annotate_opts.percent_type);
- ui_browser__show_title(&browser->b, title);
+
+ /*
+ * The annotate_browser above changed the title with the target function
+ * and now it's back to the original function. Refresh the header line
+ * for the original function again.
+ */
+ annotate_browser__show_function_title(browser);
return true;
}
--
2.51.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-08 6:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-08 6:10 [PATCH 1/3] perf annotate: Fix signatue of annotate_browser__show() Namhyung Kim
2025-09-08 6:10 ` [PATCH 2/3] perf annotate: Factor out annotate_browser__show_function_title() Namhyung Kim
2025-09-08 6:10 ` [PATCH 3/3] perf annotate: Fix title line after return from call Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®