Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableBPFStats ¶
func DisableBPFStats() error
DisableBPFStats disables collection of bpf program stats if no consumer
func EnableBPFStats ¶
func EnableBPFStats() error
EnableBPFStats enables collection of bpf program stats. It tries to use BPF_ENABLE_STATS first (which requires Linux >= 5.8). If that fails, it will fall back to trying to enable via sysctl (/proc/sys/kernel/bpf_stats_enabled). This function will make sure that repeated calls will not enable stats collection more than once. Instead, it will keep track of the number of calls and only stop stat collection, when DisableBPFStats() has been called the same number of times.
Types ¶
type BPFStatsMethod ¶
type BPFStatsMethod int
const ( // MethodNone means that no call to EnableBPFStats() has been made or was unsuccessful MethodNone BPFStatsMethod = iota // MethodBPFFunc uses stats collection via BPF(BPF_ENABLE_STATS) MethodBPFFunc // MethodSysctl uses stats collection via sysctl (/proc/sys/kernel/bpf_stats_enabled) MethodSysctl )
func GetMethod ¶
func GetMethod() BPFStatsMethod
GetMethod returns the currently used method to enable stats collection. If EnableBPFStats() has not yet been called, it will return MethodNone.