|
1 | 1 | #include <errno.h>
|
2 | 2 | #include <fcntl.h>
|
3 | 3 | #include <inttypes.h>
|
| 4 | +#include <linux/compiler.h> |
4 | 5 | #include <linux/kernel.h>
|
5 | 6 | #include <linux/types.h>
|
6 | 7 | #include <perf/cpumap.h>
|
| 8 | +#include <perf/event.h> |
| 9 | +#include <stdio.h> |
7 | 10 | #include <sys/types.h>
|
8 | 11 | #include <sys/stat.h>
|
9 | 12 | #include <unistd.h>
|
@@ -78,6 +81,7 @@ static const char *perf_event__names[] = {
|
78 | 81 | [PERF_RECORD_COMPRESSED] = "COMPRESSED",
|
79 | 82 | [PERF_RECORD_FINISHED_INIT] = "FINISHED_INIT",
|
80 | 83 | [PERF_RECORD_COMPRESSED2] = "COMPRESSED2",
|
| 84 | + [PERF_RECORD_BPF_METADATA] = "BPF_METADATA", |
81 | 85 | };
|
82 | 86 |
|
83 | 87 | const char *perf_event__name(unsigned int id)
|
@@ -505,6 +509,20 @@ size_t perf_event__fprintf_bpf(union perf_event *event, FILE *fp)
|
505 | 509 | event->bpf.type, event->bpf.flags, event->bpf.id);
|
506 | 510 | }
|
507 | 511 |
|
| 512 | +size_t perf_event__fprintf_bpf_metadata(union perf_event *event, FILE *fp) |
| 513 | +{ |
| 514 | + struct perf_record_bpf_metadata *metadata = &event->bpf_metadata; |
| 515 | + size_t ret; |
| 516 | + |
| 517 | + ret = fprintf(fp, " prog %s\n", metadata->prog_name); |
| 518 | + for (__u32 i = 0; i < metadata->nr_entries; i++) { |
| 519 | + ret += fprintf(fp, " entry %d: %20s = %s\n", i, |
| 520 | + metadata->entries[i].key, |
| 521 | + metadata->entries[i].value); |
| 522 | + } |
| 523 | + return ret; |
| 524 | +} |
| 525 | + |
508 | 526 | static int text_poke_printer(enum binary_printer_ops op, unsigned int val,
|
509 | 527 | void *extra, FILE *fp)
|
510 | 528 | {
|
@@ -602,6 +620,9 @@ size_t perf_event__fprintf(union perf_event *event, struct machine *machine, FIL
|
602 | 620 | case PERF_RECORD_AUX_OUTPUT_HW_ID:
|
603 | 621 | ret += perf_event__fprintf_aux_output_hw_id(event, fp);
|
604 | 622 | break;
|
| 623 | + case PERF_RECORD_BPF_METADATA: |
| 624 | + ret += perf_event__fprintf_bpf_metadata(event, fp); |
| 625 | + break; |
605 | 626 | default:
|
606 | 627 | ret += fprintf(fp, "\n");
|
607 | 628 | }
|
|
0 commit comments