linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] perf header: Fix pipe mode header dumping
@ 2025-07-03  4:20 Ian Rogers
  2025-07-03 18:21 ` Namhyung Kim
  2025-07-04 17:55 ` Namhyung Kim
  0 siblings, 2 replies; 3+ messages in thread
From: Ian Rogers @ 2025-07-03  4:20 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Kan Liang, linux-perf-users,
	linux-kernel

The pipe mode header dumping was accidentally removed when tracing of
header feature events in pipe mode was added.

Minor spelling tweak to header test failure message.

Fixes: 61051f9a8452 ("perf header: In pipe mode dump features without --header/-I")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/tests/shell/header.sh |  2 +-
 tools/perf/util/header.c         | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/tools/perf/tests/shell/header.sh b/tools/perf/tests/shell/header.sh
index 412263de6ed7..e1628ac0a614 100755
--- a/tools/perf/tests/shell/header.sh
+++ b/tools/perf/tests/shell/header.sh
@@ -42,7 +42,7 @@ check_header_output() {
   do
     if ! grep -q -E "$i" "${script_output}"
     then
-      echo "Failed to find expect $i in output"
+      echo "Failed to find expected $i in output"
       err=1
     fi
   done
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 487f663ed2de..53d54fbda10d 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -4343,6 +4343,7 @@ int perf_event__process_feature(struct perf_session *session,
 	int type = fe->header.type;
 	u64 feat = fe->feat_id;
 	int ret = 0;
+	bool print = dump_trace;
 
 	if (type < 0 || type >= PERF_RECORD_HEADER_MAX) {
 		pr_warning("invalid record type %d in pipe-mode\n", type);
@@ -4362,8 +4363,20 @@ int perf_event__process_feature(struct perf_session *session,
 		goto out;
 	}
 
-	if (dump_trace) {
+	if (session->tool->show_feat_hdr) {
+		if (!feat_ops[feat].full_only ||
+		    session->tool->show_feat_hdr >= SHOW_FEAT_HEADER_FULL_INFO) {
+			print = true;
+		} else {
+			fprintf(stdout, "# %s info available, use -I to display\n",
+				feat_ops[feat].name);
+		}
+	}
+
+	if (dump_trace)
 		printf(", ");
+
+	if (print) {
 		if (feat_ops[feat].print)
 			feat_ops[feat].print(&ff, stdout);
 		else
-- 
2.50.0.727.gbf7dc18ff4-goog


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

* Re: [PATCH v1] perf header: Fix pipe mode header dumping
  2025-07-03  4:20 [PATCH v1] perf header: Fix pipe mode header dumping Ian Rogers
@ 2025-07-03 18:21 ` Namhyung Kim
  2025-07-04 17:55 ` Namhyung Kim
  1 sibling, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2025-07-03 18:21 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
	Kan Liang, linux-perf-users, linux-kernel

On Wed, Jul 02, 2025 at 09:20:00PM -0700, Ian Rogers wrote:
> The pipe mode header dumping was accidentally removed when tracing of
> header feature events in pipe mode was added.
> 
> Minor spelling tweak to header test failure message.
> 
> Fixes: 61051f9a8452 ("perf header: In pipe mode dump features without --header/-I")
> Signed-off-by: Ian Rogers <irogers@google.com>

Yep, this makes the header test succeed.

Tested-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung

> ---
>  tools/perf/tests/shell/header.sh |  2 +-
>  tools/perf/util/header.c         | 15 ++++++++++++++-
>  2 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/tests/shell/header.sh b/tools/perf/tests/shell/header.sh
> index 412263de6ed7..e1628ac0a614 100755
> --- a/tools/perf/tests/shell/header.sh
> +++ b/tools/perf/tests/shell/header.sh
> @@ -42,7 +42,7 @@ check_header_output() {
>    do
>      if ! grep -q -E "$i" "${script_output}"
>      then
> -      echo "Failed to find expect $i in output"
> +      echo "Failed to find expected $i in output"
>        err=1
>      fi
>    done
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index 487f663ed2de..53d54fbda10d 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -4343,6 +4343,7 @@ int perf_event__process_feature(struct perf_session *session,
>  	int type = fe->header.type;
>  	u64 feat = fe->feat_id;
>  	int ret = 0;
> +	bool print = dump_trace;
>  
>  	if (type < 0 || type >= PERF_RECORD_HEADER_MAX) {
>  		pr_warning("invalid record type %d in pipe-mode\n", type);
> @@ -4362,8 +4363,20 @@ int perf_event__process_feature(struct perf_session *session,
>  		goto out;
>  	}
>  
> -	if (dump_trace) {
> +	if (session->tool->show_feat_hdr) {
> +		if (!feat_ops[feat].full_only ||
> +		    session->tool->show_feat_hdr >= SHOW_FEAT_HEADER_FULL_INFO) {
> +			print = true;
> +		} else {
> +			fprintf(stdout, "# %s info available, use -I to display\n",
> +				feat_ops[feat].name);
> +		}
> +	}
> +
> +	if (dump_trace)
>  		printf(", ");
> +
> +	if (print) {
>  		if (feat_ops[feat].print)
>  			feat_ops[feat].print(&ff, stdout);
>  		else
> -- 
> 2.50.0.727.gbf7dc18ff4-goog
> 

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

* Re: [PATCH v1] perf header: Fix pipe mode header dumping
  2025-07-03  4:20 [PATCH v1] perf header: Fix pipe mode header dumping Ian Rogers
  2025-07-03 18:21 ` Namhyung Kim
@ 2025-07-04 17:55 ` Namhyung Kim
  1 sibling, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2025-07-04 17:55 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
	Kan Liang, linux-perf-users, linux-kernel, Ian Rogers

On Wed, 02 Jul 2025 21:20:00 -0700, Ian Rogers wrote:
> The pipe mode header dumping was accidentally removed when tracing of
> header feature events in pipe mode was added.
> 
> Minor spelling tweak to header test failure message.
> 
> 
Applied to perf-tools-next, thanks!

Best regards,
Namhyung



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

end of thread, other threads:[~2025-07-04 17:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03  4:20 [PATCH v1] perf header: Fix pipe mode header dumping Ian Rogers
2025-07-03 18:21 ` Namhyung Kim
2025-07-04 17:55 ` Namhyung Kim

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).