Skip to content

Scoped BPF_ENABLE_STATS accounting

Step 3 of 9Solution
API
BPF_ENABLE_STATS
SYSCTL
stays 0
CLEANUP
FD-scoped
METRICS
ns + run_cnt
  • NET_RX softirq preemption
  • 3-way attribution telemetry
  • kfree_skb / PMU signal
Measuring eBPF Overhead, step 3 of 9

Pillar 1 asks: what did eBPF itself spend? Instead of flipping global sysctl kernel.bpf_stats_enabled=1 (which stays stuck on after crashes), open a scoped BPF_ENABLE_STATS file descriptor.

The kernel records exact run_time_ns, run_cnt, memlock, and JIT bytes per loaded program ID—and turns stats off automatically the instant the profiler exits (or duty-cycles via --stats-mode sample).

Type to search…

↑↓ navigate↵ selectEsc close