[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251022123259.59ada139@gandalf.local.home>
Date: Wed, 22 Oct 2025 12:32:59 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
Cc: Mark Rutland <mark.rutland@....com>, Mathieu Desnoyers
<mathieu.desnoyers@...icios.com>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH v5 2/2] tracing: Add an option to show symbols in
_text+offset for function profiler
On Thu, 23 Oct 2025 00:38:11 +0900
"Masami Hiramatsu (Google)" <mhiramat@...nel.org> wrote:
> @@ -554,7 +556,29 @@ static int function_stat_show(struct seq_file *m, void *v)
> return 0;
> #endif
>
> - kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
> + if (tr->trace_flags & TRACE_ITER(PROF_TEXT_OFFSET)) {
> + long offset;
> +
> + if (core_kernel_text(rec->ip)) {
> + refsymbol = "_text";
> + offset = rec->ip - (unsigned long)_text;
> + } else {
> + struct module *mod;
> +
> + guard(rcu)();
> + mod = __module_text_address(rec->ip);
> + if (mod) {
> + refsymbol = mod->name;
> + /* Calculate offset from module's text entry address. */
> + offset = rec->ip - (unsigned long)mod->mem[MOD_TEXT].base;
> + }
> + }
> + if (refsymbol)
> + snprintf(str, sizeof(str), " %s%+ld", refsymbol, offset);
Let's be consistent as offsets are printed as hex every place else:
snprintf(str, sizeof(str), " %s+%#lx", refsymbol, offset);
Also, did you mean to add the '+' after the '%'?
-- Steve
> + }
> + if (!refsymbol)
> + kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
> +
> seq_printf(m, " %-30.30s %10lu", str, rec->counter);
>
> #ifdef CONFIG_FUNCTION_GRAPH_TRACER
Powered by blists - more mailing lists