diff options
author | Jiayuan Chen <jiayuan.chen@linux.dev> | 2025-03-11 14:28:09 +0300 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2025-03-17 23:50:56 +0300 |
commit | 3775be3417cc3243b0df0492bd308559dcf0560b (patch) | |
tree | 33f45a2bcc436b5864e1676b3c2816b406bdfc7d /tools/bpf/bpftool/map_perf_ring.c | |
parent | 8d86767be9c9b94f196e663e0ca88e2eb604a20e (diff) | |
download | linux-3775be3417cc3243b0df0492bd308559dcf0560b.tar.xz |
bpftool: Using the right format specifiers
Fixed some formatting specifiers errors, such as using %d for int and %u
for unsigned int, as well as other byte-length types.
Perform type cast using the type derived from the data type itself, for
example, if it's originally an int, it will be cast to unsigned int if
forced to unsigned.
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250311112809.81901-3-jiayuan.chen@linux.dev
Diffstat (limited to 'tools/bpf/bpftool/map_perf_ring.c')
-rw-r--r-- | tools/bpf/bpftool/map_perf_ring.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/bpf/bpftool/map_perf_ring.c b/tools/bpf/bpftool/map_perf_ring.c index 21d7d447e1f3..552b4ca40c27 100644 --- a/tools/bpf/bpftool/map_perf_ring.c +++ b/tools/bpf/bpftool/map_perf_ring.c @@ -91,15 +91,15 @@ print_bpf_output(void *private_data, int cpu, struct perf_event_header *event) jsonw_end_object(json_wtr); } else { if (e->header.type == PERF_RECORD_SAMPLE) { - printf("== @%lld.%09lld CPU: %d index: %d =====\n", + printf("== @%llu.%09llu CPU: %d index: %d =====\n", e->time / 1000000000ULL, e->time % 1000000000ULL, cpu, idx); fprint_hex(stdout, e->data, e->size, " "); printf("\n"); } else if (e->header.type == PERF_RECORD_LOST) { - printf("lost %lld events\n", lost->lost); + printf("lost %llu events\n", lost->lost); } else { - printf("unknown event type=%d size=%d\n", + printf("unknown event type=%u size=%u\n", e->header.type, e->header.size); } } |