linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf script: Print PERF_AUX_FLAG_COLLISION flag
@ 2025-05-28 15:35 Leo Yan
  2025-05-28 18:09 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Leo Yan @ 2025-05-28 15:35 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
	Adrian Hunter, Liang, Kan, linux-perf-users
  Cc: Leo Yan

Print out the collision flag for AUX trace data. This is helpful for
inspecting sample collisions.

After:

  0x217b60@/data_nvme1n1/niayan01/upstream/perf.data [0x40]: event: 11
  .
  . ... raw event: size 64 bytes
  .  0000:  0b 00 00 00 00 00 40 00 d2 ef 3f 00 00 00 00 00  ......@...?.....
  .  0010:  ff 0f 00 00 00 00 00 00 08 00 00 00 00 00 00 00  ................
  .  0020:  1c 01 00 00 1c 01 00 00 10 bf 38 d6 11 01 00 00  ..........8.....
  .  0030:  03 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00  ................

  3 1176120114960 0x217b60 [0x40]: PERF_RECORD_AUX offset: 0x3fefd2 size: 0xfff flags: 0x8 [C]

The added character '[C]' indicates the collision.

Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 tools/perf/util/event.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index c23b77f8f854..2c3081e5c81a 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -448,12 +448,13 @@ int perf_event__exit_del_thread(const struct perf_tool *tool __maybe_unused,
 
 size_t perf_event__fprintf_aux(union perf_event *event, FILE *fp)
 {
-	return fprintf(fp, " offset: %#"PRI_lx64" size: %#"PRI_lx64" flags: %#"PRI_lx64" [%s%s%s]\n",
+	return fprintf(fp, " offset: %#"PRI_lx64" size: %#"PRI_lx64" flags: %#"PRI_lx64" [%s%s%s%s]\n",
 		       event->aux.aux_offset, event->aux.aux_size,
 		       event->aux.flags,
 		       event->aux.flags & PERF_AUX_FLAG_TRUNCATED ? "T" : "",
 		       event->aux.flags & PERF_AUX_FLAG_OVERWRITE ? "O" : "",
-		       event->aux.flags & PERF_AUX_FLAG_PARTIAL   ? "P" : "");
+		       event->aux.flags & PERF_AUX_FLAG_PARTIAL   ? "P" : "",
+		       event->aux.flags & PERF_AUX_FLAG_COLLISION ? "C" : "");
 }
 
 size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp)
-- 
2.34.1


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

* Re: [PATCH] perf script: Print PERF_AUX_FLAG_COLLISION flag
  2025-05-28 15:35 [PATCH] perf script: Print PERF_AUX_FLAG_COLLISION flag Leo Yan
@ 2025-05-28 18:09 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-05-28 18:09 UTC (permalink / raw)
  To: Leo Yan
  Cc: Namhyung Kim, Jiri Olsa, Ian Rogers, Adrian Hunter, Liang, Kan,
	linux-perf-users

On Wed, May 28, 2025 at 04:35:19PM +0100, Leo Yan wrote:
> Print out the collision flag for AUX trace data. This is helpful for
> inspecting sample collisions.
> 
> After:
> 
>   0x217b60@/data_nvme1n1/niayan01/upstream/perf.data [0x40]: event: 11
>   .
>   . ... raw event: size 64 bytes
>   .  0000:  0b 00 00 00 00 00 40 00 d2 ef 3f 00 00 00 00 00  ......@...?.....
>   .  0010:  ff 0f 00 00 00 00 00 00 08 00 00 00 00 00 00 00  ................
>   .  0020:  1c 01 00 00 1c 01 00 00 10 bf 38 d6 11 01 00 00  ..........8.....
>   .  0030:  03 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00  ................
> 
>   3 1176120114960 0x217b60 [0x40]: PERF_RECORD_AUX offset: 0x3fefd2 size: 0xfff flags: 0x8 [C]
> 
> The added character '[C]' indicates the collision.

Simple enough.
 
> Signed-off-by: Leo Yan <leo.yan@arm.com>

Thanks, applied to perf-tools-next,

- Arnaldo
> ---
>  tools/perf/util/event.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> index c23b77f8f854..2c3081e5c81a 100644
> --- a/tools/perf/util/event.c
> +++ b/tools/perf/util/event.c
> @@ -448,12 +448,13 @@ int perf_event__exit_del_thread(const struct perf_tool *tool __maybe_unused,
>  
>  size_t perf_event__fprintf_aux(union perf_event *event, FILE *fp)
>  {
> -	return fprintf(fp, " offset: %#"PRI_lx64" size: %#"PRI_lx64" flags: %#"PRI_lx64" [%s%s%s]\n",
> +	return fprintf(fp, " offset: %#"PRI_lx64" size: %#"PRI_lx64" flags: %#"PRI_lx64" [%s%s%s%s]\n",
>  		       event->aux.aux_offset, event->aux.aux_size,
>  		       event->aux.flags,
>  		       event->aux.flags & PERF_AUX_FLAG_TRUNCATED ? "T" : "",
>  		       event->aux.flags & PERF_AUX_FLAG_OVERWRITE ? "O" : "",
> -		       event->aux.flags & PERF_AUX_FLAG_PARTIAL   ? "P" : "");
> +		       event->aux.flags & PERF_AUX_FLAG_PARTIAL   ? "P" : "",
> +		       event->aux.flags & PERF_AUX_FLAG_COLLISION ? "C" : "");
>  }
>  
>  size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp)
> -- 
> 2.34.1

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

end of thread, other threads:[~2025-05-28 18:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-28 15:35 [PATCH] perf script: Print PERF_AUX_FLAG_COLLISION flag Leo Yan
2025-05-28 18:09 ` 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).