hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/tools/perf/Documentation/perf.data-file-format.txt
....@@ -43,11 +43,10 @@
4343
4444 Flags section:
4545
46
-The header is followed by different optional headers, described by the bits set
47
-in flags. Only headers for which the bit is set are included. Each header
48
-consists of a perf_file_section located after the initial header.
49
-The respective perf_file_section points to the data of the additional
50
-header and defines its size.
46
+For each of the optional features a perf_file_section it placed after the data
47
+section if the feature bit is set in the perf_header flags bitset. The
48
+respective perf_file_section points to the data of the additional header and
49
+defines its size.
5150
5251 Some headers consist of strings, which are defined like this:
5352
....@@ -127,11 +126,11 @@
127126
128127 HEADER_TOTAL_MEM = 10,
129128
130
-An uint64_t with the total memory in bytes.
129
+An uint64_t with the total memory in kilobytes.
131130
132131 HEADER_CMDLINE = 11,
133132
134
-A perf_header_string with the perf command line used to collect the data.
133
+A perf_header_string_list with the perf arg-vector used to collect the data.
135134
136135 HEADER_EVENT_DESC = 12,
137136
....@@ -152,25 +151,45 @@
152151
153152 HEADER_CPU_TOPOLOGY = 13,
154153
155
-String lists defining the core and CPU threads topology.
156
-The string lists are followed by a variable length array
157
-which contains core_id and socket_id of each cpu.
158
-The number of entries can be determined by the size of the
159
-section minus the sizes of both string lists.
160
-
161154 struct {
155
+ /*
156
+ * First revision of HEADER_CPU_TOPOLOGY
157
+ *
158
+ * See 'struct perf_header_string_list' definition earlier
159
+ * in this file.
160
+ */
161
+
162162 struct perf_header_string_list cores; /* Variable length */
163163 struct perf_header_string_list threads; /* Variable length */
164
+
165
+ /*
166
+ * Second revision of HEADER_CPU_TOPOLOGY, older tools
167
+ * will not consider what comes next
168
+ */
169
+
164170 struct {
165171 uint32_t core_id;
166172 uint32_t socket_id;
167173 } cpus[nr]; /* Variable length records */
174
+ /* 'nr' comes from previously processed HEADER_NRCPUS's nr_cpu_avail */
175
+
176
+ /*
177
+ * Third revision of HEADER_CPU_TOPOLOGY, older tools
178
+ * will not consider what comes next
179
+ */
180
+
181
+ struct perf_header_string_list dies; /* Variable length */
182
+ uint32_t die_id[nr_cpus_avail]; /* from previously processed HEADER_NR_CPUS, VLA */
168183 };
169184
170185 Example:
171
- sibling cores : 0-3
186
+ sibling sockets : 0-8
187
+ sibling dies : 0-3
188
+ sibling dies : 4-7
172189 sibling threads : 0-1
173190 sibling threads : 2-3
191
+ sibling threads : 4-5
192
+ sibling threads : 6-7
174193
175194 HEADER_NUMA_TOPOLOGY = 14,
176195
....@@ -272,6 +291,116 @@
272291 HEADER_SAMPLE_TIME = 21,
273292
274293 Two uint64_t for the time of first sample and the time of last sample.
294
+
295
+ HEADER_SAMPLE_TOPOLOGY = 22,
296
+
297
+Physical memory map and its node assignments.
298
+
299
+The format of data in MEM_TOPOLOGY is as follows:
300
+
301
+ u64 version; // Currently 1
302
+ u64 block_size_bytes; // /sys/devices/system/memory/block_size_bytes
303
+ u64 count; // number of nodes
304
+
305
+struct memory_node {
306
+ u64 node_id; // node index
307
+ u64 size; // size of bitmap
308
+ struct bitmap {
309
+ /* size of bitmap again */
310
+ u64 bitmapsize;
311
+ /* bitmap of memory indexes that belongs to node */
312
+ /* /sys/devices/system/node/node<NODE>/memory<INDEX> */
313
+ u64 entries[(bitmapsize/64)+1];
314
+ }
315
+}[count];
316
+
317
+The MEM_TOPOLOGY can be displayed with following command:
318
+
319
+$ perf report --header-only -I
320
+...
321
+# memory nodes (nr 1, block size 0x8000000):
322
+# 0 [7G]: 0-23,32-69
323
+
324
+ HEADER_CLOCKID = 23,
325
+
326
+One uint64_t for the clockid frequency, specified, for instance, via 'perf
327
+record -k' (see clock_gettime()), to enable timestamps derived metrics
328
+conversion into wall clock time on the reporting stage.
329
+
330
+ HEADER_DIR_FORMAT = 24,
331
+
332
+The data files layout is described by HEADER_DIR_FORMAT feature. Currently it
333
+holds only version number (1):
334
+
335
+ uint64_t version;
336
+
337
+The current version holds only version value (1) means that data files:
338
+
339
+- Follow the 'data.*' name format.
340
+
341
+- Contain raw events data in standard perf format as read from kernel (and need
342
+ to be sorted)
343
+
344
+Future versions are expected to describe different data files layout according
345
+to special needs.
346
+
347
+ HEADER_BPF_PROG_INFO = 25,
348
+
349
+struct bpf_prog_info_linear, which contains detailed information about
350
+a BPF program, including type, id, tag, jited/xlated instructions, etc.
351
+
352
+ HEADER_BPF_BTF = 26,
353
+
354
+Contains BPF Type Format (BTF). For more information about BTF, please
355
+refer to Documentation/bpf/btf.rst.
356
+
357
+struct {
358
+ u32 id;
359
+ u32 data_size;
360
+ char data[];
361
+};
362
+
363
+ HEADER_COMPRESSED = 27,
364
+
365
+struct {
366
+ u32 version;
367
+ u32 type;
368
+ u32 level;
369
+ u32 ratio;
370
+ u32 mmap_len;
371
+};
372
+
373
+Indicates that trace contains records of PERF_RECORD_COMPRESSED type
374
+that have perf_events records in compressed form.
375
+
376
+ HEADER_CPU_PMU_CAPS = 28,
377
+
378
+ A list of cpu PMU capabilities. The format of data is as below.
379
+
380
+struct {
381
+ u32 nr_cpu_pmu_caps;
382
+ {
383
+ char name[];
384
+ char value[];
385
+ } [nr_cpu_pmu_caps]
386
+};
387
+
388
+
389
+Example:
390
+ cpu pmu capabilities: branches=32, max_precise=3, pmu_name=icelake
391
+
392
+ HEADER_CLOCK_DATA = 29,
393
+
394
+ Contains clock id and its reference time together with wall clock
395
+ time taken at the 'same time', both values are in nanoseconds.
396
+ The format of data is as below.
397
+
398
+struct {
399
+ u32 version; /* version = 1 */
400
+ u32 clockid;
401
+ u64 wall_clock_ns;
402
+ u64 clockid_time_ns;
403
+};
275404
276405 other bits are reserved and should ignored for now
277406 HEADER_FEAT_BITS = 256,
....@@ -438,6 +567,17 @@
438567 Describes a header feature. These are records used in pipe-mode that
439568 contain information that otherwise would be in perf.data file's header.
440569
570
+ PERF_RECORD_COMPRESSED = 81,
571
+
572
+struct compressed_event {
573
+ struct perf_event_header header;
574
+ char data[];
575
+};
576
+
577
+The header is followed by compressed data frame that can be decompressed
578
+into array of perf trace records. The size of the entire compressed event
579
+record including the header is limited by the max value of header.size.
580
+
441581 Event types
442582
443583 Define the event attributes with their IDs.