linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf trace: Use consistent print_opts formatting in trace__fprintf_callchain()
@ 2025-08-26  8:08 Ahmed Atef El-Emary
  2025-09-13 14:43 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmed Atef El-Emary @ 2025-08-26  8:08 UTC (permalink / raw)
  To: acme
  Cc: linux-perf-users, linux-kernel, namhyung, irogers, jolsa,
	adrian.hunter, ahmed.software.engineer1

trace__fprintf_callchain() previously omitted IP and symoffset from its
print_opts, unlike other callchain printers in perf. This resulted in
less detailed and inconsistent callchain output.

Add EVSEL__PRINT_IP and EVSEL__PRINT_SYMOFFSET to make the output more
consistent and informative. The callchain output now includes IP, symbol
offset, DSO, and falls back to the raw address when no symbol is found,
matching the detail level of other perf callchain outputs.

Signed-off-by: Ahmed Atef El-Emary <ahmed.software.engineer1@gmail.com>
---
 tools/perf/builtin-trace.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index fe737b3ac6e6..20f3488d4a21 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2892,8 +2892,10 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sam
 {
 	/* TODO: user-configurable print_opts */
 	const unsigned int print_opts = EVSEL__PRINT_SYM |
-				        EVSEL__PRINT_DSO |
-				        EVSEL__PRINT_UNKNOWN_AS_ADDR;
+				EVSEL__PRINT_DSO |
+				EVSEL__PRINT_UNKNOWN_AS_ADDR |
+				EVSEL__PRINT_IP |
+				EVSEL__PRINT_SYMOFFSET;
 
 	return sample__fprintf_callchain(sample, 38, print_opts, get_tls_callchain_cursor(), symbol_conf.bt_stop_list, trace->output);
 }
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf trace: Use consistent print_opts formatting in trace__fprintf_callchain()
  2025-08-26  8:08 [PATCH] perf trace: Use consistent print_opts formatting in trace__fprintf_callchain() Ahmed Atef El-Emary
@ 2025-09-13 14:43 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-09-13 14:43 UTC (permalink / raw)
  To: Ahmed Atef El-Emary
  Cc: linux-perf-users, linux-kernel, namhyung, irogers, jolsa,
	adrian.hunter

On Tue, Aug 26, 2025 at 11:08:11AM +0300, Ahmed Atef El-Emary wrote:
> trace__fprintf_callchain() previously omitted IP and symoffset from its
> print_opts, unlike other callchain printers in perf. This resulted in
> less detailed and inconsistent callchain output.
> 
> Add EVSEL__PRINT_IP and EVSEL__PRINT_SYMOFFSET to make the output more
> consistent and informative. The callchain output now includes IP, symbol
> offset, DSO, and falls back to the raw address when no symbol is found,
> matching the detail level of other perf callchain outputs.

Can you please exemplify before and after output in addition of just
describing the changes?

- Arnaldo
 
> Signed-off-by: Ahmed Atef El-Emary <ahmed.software.engineer1@gmail.com>
> ---
>  tools/perf/builtin-trace.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> index fe737b3ac6e6..20f3488d4a21 100644
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
> @@ -2892,8 +2892,10 @@ static int trace__fprintf_callchain(struct trace *trace, struct perf_sample *sam
>  {
>  	/* TODO: user-configurable print_opts */
>  	const unsigned int print_opts = EVSEL__PRINT_SYM |
> -				        EVSEL__PRINT_DSO |
> -				        EVSEL__PRINT_UNKNOWN_AS_ADDR;
> +				EVSEL__PRINT_DSO |
> +				EVSEL__PRINT_UNKNOWN_AS_ADDR |
> +				EVSEL__PRINT_IP |
> +				EVSEL__PRINT_SYMOFFSET;
>  
>  	return sample__fprintf_callchain(sample, 38, print_opts, get_tls_callchain_cursor(), symbol_conf.bt_stop_list, trace->output);
>  }
> -- 
> 2.43.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-13 14:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-26  8:08 [PATCH] perf trace: Use consistent print_opts formatting in trace__fprintf_callchain() Ahmed Atef El-Emary
2025-09-13 14:43 ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).