.. | .. |
---|
43 | 43 | |
---|
44 | 44 | Flags section: |
---|
45 | 45 | |
---|
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. |
---|
51 | 50 | |
---|
52 | 51 | Some headers consist of strings, which are defined like this: |
---|
53 | 52 | |
---|
.. | .. |
---|
127 | 126 | |
---|
128 | 127 | HEADER_TOTAL_MEM = 10, |
---|
129 | 128 | |
---|
130 | | -An uint64_t with the total memory in bytes. |
---|
| 129 | +An uint64_t with the total memory in kilobytes. |
---|
131 | 130 | |
---|
132 | 131 | HEADER_CMDLINE = 11, |
---|
133 | 132 | |
---|
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. |
---|
135 | 134 | |
---|
136 | 135 | HEADER_EVENT_DESC = 12, |
---|
137 | 136 | |
---|
.. | .. |
---|
152 | 151 | |
---|
153 | 152 | HEADER_CPU_TOPOLOGY = 13, |
---|
154 | 153 | |
---|
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 | | - |
---|
161 | 154 | 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 | + |
---|
162 | 162 | struct perf_header_string_list cores; /* Variable length */ |
---|
163 | 163 | 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 | + |
---|
164 | 170 | struct { |
---|
165 | 171 | uint32_t core_id; |
---|
166 | 172 | uint32_t socket_id; |
---|
167 | 173 | } 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 */ |
---|
168 | 183 | }; |
---|
169 | 184 | |
---|
170 | 185 | Example: |
---|
171 | | - sibling cores : 0-3 |
---|
| 186 | + sibling sockets : 0-8 |
---|
| 187 | + sibling dies : 0-3 |
---|
| 188 | + sibling dies : 4-7 |
---|
172 | 189 | sibling threads : 0-1 |
---|
173 | 190 | sibling threads : 2-3 |
---|
| 191 | + sibling threads : 4-5 |
---|
| 192 | + sibling threads : 6-7 |
---|
174 | 193 | |
---|
175 | 194 | HEADER_NUMA_TOPOLOGY = 14, |
---|
176 | 195 | |
---|
.. | .. |
---|
272 | 291 | HEADER_SAMPLE_TIME = 21, |
---|
273 | 292 | |
---|
274 | 293 | 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 | +}; |
---|
275 | 404 | |
---|
276 | 405 | other bits are reserved and should ignored for now |
---|
277 | 406 | HEADER_FEAT_BITS = 256, |
---|
.. | .. |
---|
438 | 567 | Describes a header feature. These are records used in pipe-mode that |
---|
439 | 568 | contain information that otherwise would be in perf.data file's header. |
---|
440 | 569 | |
---|
| 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 | + |
---|
441 | 581 | Event types |
---|
442 | 582 | |
---|
443 | 583 | Define the event attributes with their IDs. |
---|