diff --git a/bpf/kprobe_pwru.c b/bpf/kprobe_pwru.c index ec6e4761..68a8fed8 100644 --- a/bpf/kprobe_pwru.c +++ b/bpf/kprobe_pwru.c @@ -368,7 +368,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 24421af4..2414afc8 100644 --- a/internal/pwru/output.go +++ b/internal/pwru/output.go @@ -466,7 +466,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)) }