diff --git a/bpf/kprobe_pwru.c b/bpf/kprobe_pwru.c index a99b2fdc..f2b3e260 100644 --- a/bpf/kprobe_pwru.c +++ b/bpf/kprobe_pwru.c @@ -367,7 +367,7 @@ static __always_inline u64 sync_fetch_and_add(void *id_map) { u32 *id = bpf_map_lookup_elem(id_map, &ZERO); if (id) - return ((*id)++) | ((u64)bpf_get_smp_processor_id() << 32); + return ((*id)++) | ((u64)(bpf_get_smp_processor_id() + 1) << 32); return 0; } diff --git a/internal/pwru/output.go b/internal/pwru/output.go index 128edb1f..fbf17975 100644 --- a/internal/pwru/output.go +++ b/internal/pwru/output.go @@ -458,7 +458,7 @@ func (o *output) Print(event *Event) { fmt.Fprintf(o.writer, "%s", getShinfoData(event, o)) } - if o.flags.OutputBpfmap { + if o.flags.OutputBpfmap && event.PrintBpfmapId > 0 { fmt.Fprintf(o.writer, "%s", getBpfMapData(event, o)) }