Add perf exporter (#1274)
Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
This commit is contained in:
parent
0c6b90be4e
commit
7882009870
41 changed files with 4285 additions and 0 deletions
22
vendor/github.com/hodgesds/perf-utils/bpf.go
generated
vendored
Normal file
22
vendor/github.com/hodgesds/perf-utils/bpf.go
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// +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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue