Skip to contentSkip to conversation

Pipe mode header dumping and minor space saving

PATCH Applied Ian Rogers 2 participants 9 messages Jun 7, 2025 – Jun 26, 2025

Subsystems (2)
lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

cover Pipe mode header dumping and minor space saving

Pipe mode has no header and emits the data as if it were events. The dumping of features was controlled by the --header/-I options which makes little sense when they are events, normally traced when dump_trace is true. Switch to making pipe feature events also be traced with detail when other events are.

The attr event in pipe mode had no dumping, wire this up and use the existing perf_event_attr fprintf support.

The header's bpf_prog_info or bpf_btf may be empty when written. If they are empty just skip writing them to save space.

Ian Rogers (4):
perf header: In pipe mode dump features without --header/-I perf header: Allow tracing of attr events
perf header: Display message if BPF/BTF info is empty perf header: Don't write empty BPF/BTF info

 tools/perf/util/header.c | 46 ++++++++++++++++++++++++++--------------
 tools/perf/util/header.h |  1 +
 2 files changed, 31 insertions(+), 16 deletions(-)
Signature · 1 line
2.50.0.rc0.604.gd4ff7b7c86-goog
author reviewer
#1 lore raw

PATCH 1/4 perf header: In pipe mode dump features without --header/-I

In pipe mode the header features are contained within events. While other events dump details the header features only dump if --header or -I are passed, which doesn't make sense as in pipe mode there is no perf file header. Make the printing of the information conditional on dump_trace as with other events.

Before:

```
$ perf record -o - -a sleep 1 | perf script -D -i -
...
0x2c8@pipe [0x54]: event: 80
.
. ... raw event: size 84 bytes
.  0000:  50 00 00 00 00 00 54 00 05 00 00 00 00 00 00 00  P.....T.........
.  0010:  40 00 00 00 36 2e 31 35 2e 72 63 37 2e 67 61 64  @...6.15.rc7.gad
.  0020:  32 61 36 39 31 63 39 39 66 62 00 00 00 00 00 00  2a691c99fb......
.  0030:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0040:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0050:  00 00 00 00                                      ....

0 0 0x2c8 [0x54]: PERF_RECORD_FEATURE
```

After:

```
$ perf record -o - -a sleep 1 | perf script -D -i -
...
0x2c8@pipe [0x54]: event: 80
.
. ... raw event: size 84 bytes
.  0000:  50 00 00 00 00 00 54 00 05 00 00 00 00 00 00 00  P.....T.........
.  0010:  40 00 00 00 36 2e 31 35 2e 72 63 37 2e 67 61 64  @...6.15.rc7.gad
.  0020:  32 61 36 39 31 63 39 39 66 62 00 00 00 00 00 00  2a691c99fb......
.  0030:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0040:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0050:  00 00 00 00                                      ....

0 0 0x2c8 [0x54]: PERF_RECORD_FEATURE, # perf version : 6.15.rc7.gad2a691c99fb
```
---
 tools/perf/util/header.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)
tools/perf/util/header.c +8 -14
index e3cdc3b7b4ab..84879d7fdffe 100644
@@ -4341,7 +4341,6 @@ int perf_session__read_header(struct perf_session *session)
 int perf_event__process_feature(struct perf_session *session,
 				union perf_event *event)
 {
-	const struct perf_tool *tool = session->tool;
 	struct feat_fd ff = { .fd = 0 };
 	struct perf_record_header_feature *fe = (struct perf_record_header_feature *)event;
 	int type = fe->header.type;
@@ -4357,28 +4356,23 @@ int perf_event__process_feature(struct perf_session *session,
 		return -1;
 	}
 
-	if (!feat_ops[feat].process)
-		return 0;
-
 	ff.buf  = (void *)fe->data;
 	ff.size = event->header.size - sizeof(*fe);
 	ff.ph = &session->header;
 
-	if (feat_ops[feat].process(&ff, NULL)) {
+	if (feat_ops[feat].process && feat_ops[feat].process(&ff, NULL)) {
 		ret = -1;
 		goto out;
 	}
 
-	if (!feat_ops[feat].print || !tool->show_feat_hdr)
-		goto out;
-
-	if (!feat_ops[feat].full_only ||
-	    tool->show_feat_hdr >= SHOW_FEAT_HEADER_FULL_INFO) {
-		feat_ops[feat].print(&ff, stdout);
-	} else {
-		fprintf(stdout, "# %s info available, use -I to display\n",
-			feat_ops[feat].name);
+	if (dump_trace) {
+		printf(", ");
+		if (feat_ops[feat].print)
+			feat_ops[feat].print(&ff, stdout);
+		else
+			printf("# %s", feat_ops[feat].name);
 	}
+
 out:
 	free_event_desc(ff.events);
 	return ret;
Signature · 1 line
2.50.0.rc0.604.gd4ff7b7c86-goog
author reviewer
#2 lore raw

PATCH 2/4 perf header: Allow tracing of attr events

In reply to Ian Rogers

In pipe mode attr events capture the perf_event_attr. Allow their dumping as they normally start the file.

Before:

```
$ perf record -o - -a sleep 1 | perf script -D -i -
. ... raw event: size 272 bytes
.  0000:  40 00 00 00 00 00 10 01 00 00 00 00 88 00 00 00  @...............
.  0010:  00 00 00 00 00 00 00 00 a0 0f 00 00 00 00 00 00  ................
.  0020:  87 01 01 00 00 00 00 00 14 00 00 00 00 00 00 00  ................
.  0030:  01 84 05 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0040:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0050:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0060:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0070:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0080:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0090:  91 08 00 00 00 00 00 00 92 08 00 00 00 00 00 00  ................
.  00a0:  93 08 00 00 00 00 00 00 94 08 00 00 00 00 00 00  ................
.  00b0:  95 08 00 00 00 00 00 00 96 08 00 00 00 00 00 00  ................
.  00c0:  97 08 00 00 00 00 00 00 98 08 00 00 00 00 00 00  ................
.  00d0:  99 08 00 00 00 00 00 00 9a 08 00 00 00 00 00 00  ................
.  00e0:  9b 08 00 00 00 00 00 00 9c 08 00 00 00 00 00 00  ................
.  00f0:  9d 08 00 00 00 00 00 00 9e 08 00 00 00 00 00 00  ................
.  0100:  9f 08 00 00 00 00 00 00 a0 08 00 00 00 00 00 00  ................

-1 -1 0 [0x110]: PERF_RECORD_ATTR
0x110@pipe [0x110]: event: 64
...
```

After:

```
$ perf record -o - -a sleep 1 | perf script -D -i -
0@pipe [0x110]: event: 64
.
. ... raw event: size 272 bytes
.  0000:  40 00 00 00 00 00 10 01 00 00 00 00 88 00 00 00  @...............
.  0010:  00 00 00 00 00 00 00 00 a0 0f 00 00 00 00 00 00  ................
.  0020:  87 01 01 00 00 00 00 00 14 00 00 00 00 00 00 00  ................
.  0030:  01 84 05 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0040:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0050:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0060:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0070:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0080:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0090:  5c 08 00 00 00 00 00 00 5d 08 00 00 00 00 00 00  \.......].......
.  00a0:  5e 08 00 00 00 00 00 00 5f 08 00 00 00 00 00 00  ^......._.......
.  00b0:  60 08 00 00 00 00 00 00 61 08 00 00 00 00 00 00  `.......a.......
.  00c0:  62 08 00 00 00 00 00 00 63 08 00 00 00 00 00 00  b.......c.......
.  00d0:  64 08 00 00 00 00 00 00 65 08 00 00 00 00 00 00  d.......e.......
.  00e0:  66 08 00 00 00 00 00 00 67 08 00 00 00 00 00 00  f.......g.......
.  00f0:  68 08 00 00 00 00 00 00 69 08 00 00 00 00 00 00  h.......i.......
.  0100:  6a 08 00 00 00 00 00 00 6b 08 00 00 00 00 00 00  j.......k.......

-1 -1 0 [0x110]: PERF_RECORD_ATTR, type = 0 (PERF_TYPE_HARDWARE), size = 136, config = 0 (PERF_COUNT_HW_CPU_CYCLES), { sample_period, sample_freq } = 4000, sample_type = IP|TID|TIME|CPU|PERIOD|IDENTIFIER, read_format = ID|LOST, disabled = 1, freq = 1, precise_ip = 3, sample_id_all = 1
0x110@pipe [0x110]: event: 64
...
```
---
 tools/perf/util/header.c | 8 ++++++++
 tools/perf/util/header.h | 1 +
 2 files changed, 9 insertions(+)
tools/perf/util/header.c +8 -0
index 84879d7fdffe..7798435ab5d3 100644
@@ -4414,6 +4414,11 @@ size_t perf_event__fprintf_event_update(union perf_event *event, FILE *fp)
 	return ret;
 }
 
+size_t perf_event__fprintf_attr(union perf_event *event, FILE *fp)
+{
+	return perf_event_attr__fprintf(fp, &event->attr.attr, __desc_attr__fprintf, NULL);
+}
+
 int perf_event__process_attr(const struct perf_tool *tool __maybe_unused,
 			     union perf_event *event,
 			     struct evlist **pevlist)
@@ -4423,6 +4428,9 @@ int perf_event__process_attr(const struct perf_tool *tool __maybe_unused,
 	struct evsel *evsel;
 	struct evlist *evlist = *pevlist;
 
+	if (dump_trace)
+		perf_event__fprintf_attr(event, stdout);
+
 	if (evlist == NULL) {
 		*pevlist = evlist = evlist__new();
 		if (evlist == NULL)
tools/perf/util/header.h +1 -0
index 5201af6305f4..d16dfceccd74 100644
@@ -175,6 +175,7 @@ int perf_event__process_attr(const struct perf_tool *tool, union perf_event *eve
 int perf_event__process_event_update(const struct perf_tool *tool,
 				     union perf_event *event,
 				     struct evlist **pevlist);
+size_t perf_event__fprintf_attr(union perf_event *event, FILE *fp);
 size_t perf_event__fprintf_event_update(union perf_event *event, FILE *fp);
 #ifdef HAVE_LIBTRACEEVENT
 int perf_event__process_tracing_data(struct perf_session *session,
Signature · 1 line
2.50.0.rc0.604.gd4ff7b7c86-goog
author reviewer
#3 lore raw

PATCH 3/4 perf header: Display message if BPF/BTF info is empty

In reply to Ian Rogers

The perf.data file may contain a bpf_prog_info or bpf_btf feature. If the contents of these are empty then nothing is displayed. Rather than display nothing and not account for the file space, display an empty message.

---
 tools/perf/util/header.c | 6 ++++++
 1 file changed, 6 insertions(+)
tools/perf/util/header.c +6 -0
index 7798435ab5d3..69e4f6aae293 100644
@@ -1814,6 +1814,9 @@ static void print_bpf_prog_info(struct feat_fd *ff, FILE *fp)
 	root = &env->bpf_progs.infos;
 	next = rb_first(root);
 
+	if (!next)
+		printf("# bpf_prog_info empty\n");
+
 	while (next) {
 		struct bpf_prog_info_node *node;
 
@@ -1838,6 +1841,9 @@ static void print_bpf_btf(struct feat_fd *ff, FILE *fp)
 	root = &env->bpf_progs.btfs;
 	next = rb_first(root);
 
+	if (!next)
+		printf("# btf info empty\n");
+
 	while (next) {
 		struct btf_node *node;
 
Signature · 1 line
2.50.0.rc0.604.gd4ff7b7c86-goog
author reviewer
#4 lore raw

PATCH 4/4 perf header: Don't write empty BPF/BTF info

In reply to Ian Rogers

If there are no values in bpf_prog_info or bpf_btf feature don't write the data into the header.

---
 tools/perf/util/header.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tools/perf/util/header.c +8 -2
index 69e4f6aae293..6657b02d4a81 100644
@@ -1016,10 +1016,13 @@ static int write_bpf_prog_info(struct feat_fd *ff,
 	struct perf_env *env = &ff->ph->env;
 	struct rb_root *root;
 	struct rb_node *next;
-	int ret;
+	int ret = 0;
 
 	down_read(&env->bpf_progs.lock);
 
+	if (env->bpf_progs.infos_cnt == 0)
+		goto out;
+
 	ret = do_write(ff, &env->bpf_progs.infos_cnt,
 		       sizeof(env->bpf_progs.infos_cnt));
 	if (ret < 0)
@@ -1058,10 +1061,13 @@ static int write_bpf_btf(struct feat_fd *ff,
 	struct perf_env *env = &ff->ph->env;
 	struct rb_root *root;
 	struct rb_node *next;
-	int ret;
+	int ret = 0;
 
 	down_read(&env->bpf_progs.lock);
 
+	if (env->bpf_progs.btfs_cnt == 0)
+		goto out;
+
 	ret = do_write(ff, &env->bpf_progs.btfs_cnt,
 		       sizeof(env->bpf_progs.btfs_cnt));
 
Signature · 1 line
2.50.0.rc0.604.gd4ff7b7c86-goog
maintainer
#5 lore raw
In reply to Ian Rogers
Quoted 5 lines · Ian Rogers

Pipe mode has no header and emits the data as if it were events. The dumping of features was controlled by the --header/-I options which makes little sense when they are events, normally traced when dump_trace is true. Switch to making pipe feature events also be traced with detail when other events are.

I'm not sure I'm following. Are you saying the pipe mode doesn't support features with --header/-I option?

It seems to work for me.

  $ git show
  commit be59dba332e1e8edd3e88d991ba0e4795ae2bcb2 (HEAD -> perf-testing)
  Author: Ian Rogers <[email protected]>
  Date:   Tue Jun 17 15:33:56 2025 -0700

libperf evsel: Add missed puts and asserts

A missed evsel__close before evsel__delete was the source of leaking perf events due to a hybrid test. Add asserts in debug builds so that this shouldn't happen in the future. Add puts missing on the cpu map and thread maps.

  $ ./perf version
  perf version 6.16.rc3.gbe59dba332e1
  $ ./perf record -o- true | ./perf report -i- --header-only
  # ========
  # captured on    : Tue Jun 24 12:06:38 2025
  # header version : 1
  # data offset    : 0
  # data size      : 0
  # feat offset    : 0
  # ========
  #
  # hostname : bangji
  # os release : 6.12.20-1rodete1-amd64
  # perf version : 6.16.rc3.gbe59dba332e1
  # arch : x86_64
  # nrcpus online : 4
  # nrcpus avail : 8
  # cpudesc : 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
  # cpuid : GenuineIntel,6,140,1
  # total memory : 32566540 kB
  # cmdline : /home/namhyung/project/linux/tools/perf/perf record -o- true 
  # event : name = cycles:P, , id = { 369, 370, 371, 372 }, type = 0 (PERF_TYPE_HARDWARE), ...
  # CPU_TOPOLOGY info available, use -I to display
  # NUMA_TOPOLOGY info available, use -I to display
  # pmu mappings: cpu = 4, breakpoint = 5, cstate_core = 22, cstate_pkg = 23, hwmon_acpitz = 4294901760, ...
  # time of first sample : 0.000000
  # time of last sample : 0.000000
  # sample duration :      0.000 ms
  # MEM_TOPOLOGY info available, use -I to display
  # cpu pmu capabilities: branches=32, max_precise=3, pmu_name=icelake
  # intel_pt pmu capabilities: topa_multiple_entries=1, psb_cyc=1, single_range_output=1, ...
Quoted 6 lines

The attr event in pipe mode had no dumping, wire this up and use the existing perf_event_attr fprintf support.

The header's bpf_prog_info or bpf_btf may be empty when written. If they are empty just skip writing them to save space.

These look good to me.

Thanks,
Namhyung

Quoted 14 lines

Ian Rogers (4):
perf header: In pipe mode dump features without --header/-I perf header: Allow tracing of attr events
perf header: Display message if BPF/BTF info is empty perf header: Don't write empty BPF/BTF info

 tools/perf/util/header.c | 46 ++++++++++++++++++++++++++--------------
 tools/perf/util/header.h |  1 +
 2 files changed, 31 insertions(+), 16 deletions(-)
Signature · 1 line
2.50.0.rc0.604.gd4ff7b7c86-goog
author reviewer
#6 lore raw
Quoted 10 lines · Namhyung Kim
Quoted 5 lines · Ian Rogers

Pipe mode has no header and emits the data as if it were events. The dumping of features was controlled by the --header/-I options which makes little sense when they are events, normally traced when dump_trace is true. Switch to making pipe feature events also be traced with detail when other events are.

I'm not sure I'm following. Are you saying the pipe mode doesn't support features with --header/-I option?

No, in pipe mode it currently shows just PERF_RECORD_FEATURE or PERF_RECORD_ATTR for the details of the events containing these things. The reason being that the dumping is controlled by separate header flags (--header and -I). In patch 1 the commit message shows the before:

```
$ perf record -o - -a sleep 1 | perf script -D -i -
...
0x2c8@pipe [0x54]: event: 80
.
. ... raw event: size 84 bytes
.  0000:  50 00 00 00 00 00 54 00 05 00 00 00 00 00 00 00  P.....T.........
.  0010:  40 00 00 00 36 2e 31 35 2e 72 63 37 2e 67 61 64  @...6.15.rc7.gad
.  0020:  32 61 36 39 31 63 39 39 66 62 00 00 00 00 00 00  2a691c99fb......
.  0030:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0040:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0050:  00 00 00 00                                      ....

0 0 0x2c8 [0x54]: PERF_RECORD_FEATURE
```

That is we have a feature "event" but there are no details there to try to be able to understand the feature event. After the change this becomes:

```
$ perf record -o - -a sleep 1 | perf script -D -i -
...
0x2c8@pipe [0x54]: event: 80
.
. ... raw event: size 84 bytes
.  0000:  50 00 00 00 00 00 54 00 05 00 00 00 00 00 00 00  P.....T.........
.  0010:  40 00 00 00 36 2e 31 35 2e 72 63 37 2e 67 61 64  @...6.15.rc7.gad
.  0020:  32 61 36 39 31 63 39 39 66 62 00 00 00 00 00 00  2a691c99fb......
.  0030:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0040:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0050:  00 00 00 00                                      ....

0 0 0x2c8 [0x54]: PERF_RECORD_FEATURE, # perf version : 6.15.rc7.gad2a691c99fb
```

So now in the dump trace output I can see this was a feature for perf version and what that value is. There are often multiple PERF_RECORD_FEATURE and PERF_RECORD_ATTR "events" and so the extra trace output helps in being able to work out what's going on.

Thanks,
Ian

Quoted 77 lines

It seems to work for me.

  $ git show
  commit be59dba332e1e8edd3e88d991ba0e4795ae2bcb2 (HEAD -> perf-testing)
  Author: Ian Rogers <[email protected]>
  Date:   Tue Jun 17 15:33:56 2025 -0700

libperf evsel: Add missed puts and asserts

A missed evsel__close before evsel__delete was the source of leaking perf events due to a hybrid test. Add asserts in debug builds so that this shouldn't happen in the future. Add puts missing on the cpu map and thread maps.

  $ ./perf version
  perf version 6.16.rc3.gbe59dba332e1
  $ ./perf record -o- true | ./perf report -i- --header-only
  # ========
  # captured on    : Tue Jun 24 12:06:38 2025
  # header version : 1
  # data offset    : 0
  # data size      : 0
  # feat offset    : 0
  # ========
  #
  # hostname : bangji
  # os release : 6.12.20-1rodete1-amd64
  # perf version : 6.16.rc3.gbe59dba332e1
  # arch : x86_64
  # nrcpus online : 4
  # nrcpus avail : 8
  # cpudesc : 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
  # cpuid : GenuineIntel,6,140,1
  # total memory : 32566540 kB
  # cmdline : /home/namhyung/project/linux/tools/perf/perf record -o- true
  # event : name = cycles:P, , id = { 369, 370, 371, 372 }, type = 0 (PERF_TYPE_HARDWARE), ...
  # CPU_TOPOLOGY info available, use -I to display
  # NUMA_TOPOLOGY info available, use -I to display
  # pmu mappings: cpu = 4, breakpoint = 5, cstate_core = 22, cstate_pkg = 23, hwmon_acpitz = 4294901760, ...
  # time of first sample : 0.000000
  # time of last sample : 0.000000
  # sample duration :      0.000 ms
  # MEM_TOPOLOGY info available, use -I to display
  # cpu pmu capabilities: branches=32, max_precise=3, pmu_name=icelake
  # intel_pt pmu capabilities: topa_multiple_entries=1, psb_cyc=1, single_range_output=1, ...
Quoted 6 lines

The attr event in pipe mode had no dumping, wire this up and use the existing perf_event_attr fprintf support.

The header's bpf_prog_info or bpf_btf may be empty when written. If they are empty just skip writing them to save space.

These look good to me.

Thanks,
Namhyung

Quoted 14 lines

Ian Rogers (4):
perf header: In pipe mode dump features without --header/-I perf header: Allow tracing of attr events
perf header: Display message if BPF/BTF info is empty perf header: Don't write empty BPF/BTF info

 tools/perf/util/header.c | 46 ++++++++++++++++++++++++++--------------
 tools/perf/util/header.h |  1 +
 2 files changed, 31 insertions(+), 16 deletions(-)

--
2.50.0.rc0.604.gd4ff7b7c86-goog

maintainer
#7 lore raw
Quoted 52 lines · Ian Rogers
Quoted 10 lines · Namhyung Kim
Quoted 5 lines · Ian Rogers

Pipe mode has no header and emits the data as if it were events. The dumping of features was controlled by the --header/-I options which makes little sense when they are events, normally traced when dump_trace is true. Switch to making pipe feature events also be traced with detail when other events are.

I'm not sure I'm following. Are you saying the pipe mode doesn't support features with --header/-I option?

No, in pipe mode it currently shows just PERF_RECORD_FEATURE or PERF_RECORD_ATTR for the details of the events containing these things. The reason being that the dumping is controlled by separate header flags (--header and -I). In patch 1 the commit message shows the before:

```
$ perf record -o - -a sleep 1 | perf script -D -i -
...
0x2c8@pipe [0x54]: event: 80
.
. ... raw event: size 84 bytes
.  0000:  50 00 00 00 00 00 54 00 05 00 00 00 00 00 00 00  P.....T.........
.  0010:  40 00 00 00 36 2e 31 35 2e 72 63 37 2e 67 61 64  @...6.15.rc7.gad
.  0020:  32 61 36 39 31 63 39 39 66 62 00 00 00 00 00 00  2a691c99fb......
.  0030:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0040:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0050:  00 00 00 00                                      ....

0 0 0x2c8 [0x54]: PERF_RECORD_FEATURE
```

That is we have a feature "event" but there are no details there to try to be able to understand the feature event. After the change this becomes:

```
$ perf record -o - -a sleep 1 | perf script -D -i -
...
0x2c8@pipe [0x54]: event: 80
.
. ... raw event: size 84 bytes
.  0000:  50 00 00 00 00 00 54 00 05 00 00 00 00 00 00 00  P.....T.........
.  0010:  40 00 00 00 36 2e 31 35 2e 72 63 37 2e 67 61 64  @...6.15.rc7.gad
.  0020:  32 61 36 39 31 63 39 39 66 62 00 00 00 00 00 00  2a691c99fb......
.  0030:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0040:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
.  0050:  00 00 00 00                                      ....

0 0 0x2c8 [0x54]: PERF_RECORD_FEATURE, # perf version : 6.15.rc7.gad2a691c99fb
```
Quoted 4 lines

So now in the dump trace output I can see this was a feature for perf version and what that value is. There are often multiple PERF_RECORD_FEATURE and PERF_RECORD_ATTR "events" and so the extra trace output helps in being able to work out what's going on.

Thanks for the clarification, I was confused if it's fixing -I or -D. :)

Namhyung

maintainer Applied
#8 lore raw
In reply to Ian Rogers
Quoted 10 lines · Ian Rogers

Pipe mode has no header and emits the data as if it were events. The dumping of features was controlled by the --header/-I options which makes little sense when they are events, normally traced when dump_trace is true. Switch to making pipe feature events also be traced with detail when other events are.

The attr event in pipe mode had no dumping, wire this up and use the existing perf_event_attr fprintf support.

[...]

Applied to perf-tools-next, thanks!

Best regards,
Namhyung