]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf header: Fix pipe mode header dumping
authorIan Rogers <irogers@google.com>
Thu, 3 Jul 2025 04:20:00 +0000 (21:20 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 3 Jul 2025 18:22:17 +0000 (11:22 -0700)
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>
Tested-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20250703042000.2740640-1-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/tests/shell/header.sh
tools/perf/util/header.c

index 412263de6ed70386892a6e8d4031dff29bdc241d..e1628ac0a61401a73980f80a6f6ae2ed51d81b98 100755 (executable)
@@ -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
index 487f663ed2de058aa20eb8b2c47544c1f53b9c45..53d54fbda10da34321cb4a247a905ee4aefb0875 100644 (file)
@@ -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