You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
node_exporter/vendor/github.com/hodgesds/perf-utils/bpf.go

23 lines
588 B

// +build linux
package perf
import (
"golang.org/x/sys/unix"
)
// BPFProfiler is a Profiler that allows attaching a Berkeley
// Packet Filter (BPF) program to an existing kprobe tracepoint event.
// You need CAP_SYS_ADMIN privileges to use this interface. See:
// https://lwn.net/Articles/683504/
type BPFProfiler interface {
Profiler
AttachBPF(int) error
}
// AttachBPF is used to attach a BPF program to a profiler by using the file
// descriptor of the BPF program.
func (p *profiler) AttachBPF(fd int) error {
return unix.IoctlSetInt(p.fd, unix.PERF_EVENT_IOC_SET_BPF, fd)
}