Skip to contentSkip to conversation

perf header: Fix pipe mode header dumping

PATCH Applied Ian Rogers 2 participants 3 messages Jul 3, 2025 – Jul 4, 2025 perf events

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

PATCH 1/1 perf header: Fix pipe mode header dumping

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")
---
 tools/perf/tests/shell/header.sh |  2 +-
 tools/perf/util/header.c         | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
tools/perf/tests/shell/header.sh +1 -1
index 412263de6ed7..e1628ac0a614 100755
@@ -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
tools/perf/util/header.c +14 -1
index 487f663ed2de..53d54fbda10d 100644
@@ -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
Signature · 1 line
2.50.0.727.gbf7dc18ff4-goog
maintainer Tested-by on v1 1/1
#1 lore raw
Quoted 7 lines · Ian Rogers

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

Yep, this makes the header test succeed.

Thanks,
Namhyung

Quoted 55 lines
---
 tools/perf/tests/shell/header.sh |  2 +-
 tools/perf/util/header.c         | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
tools/perf/tests/shell/header.sh +1 -1
index 412263de6ed7..e1628ac0a614 100755
@@ -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
tools/perf/util/header.c +14 -1
index 487f663ed2de..53d54fbda10d 100644
@@ -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
Signature · 1 line
2.50.0.727.gbf7dc18ff4-goog
maintainer Applied
#2 lore raw
In reply to Ian Rogers
Quoted 6 lines · Ian Rogers

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