modulepackage
0.0.0-20230314124411-39be138ea1d7
Repository: https://github.com/mimetrix/ebpfbench.git
Documentation: pkg.go.dev
# README
ebpfbench
profile eBPF programs from Go. Requires Linux kernel 5.1 or greater.
Examples
cd examples/bench
go run -exec sudo ./bench
Usage
ebpfbench
augments the standard testing.B
object.
func BenchmarkExample(b *testing.B) {
eb := ebpfbench.NewEBPFBenchmark(b)
defer eb.Close()
// setup eBPF programs using cilium/ebpf, gobpf, or other libraries.
fd := prog.FD()
eb.ProfileProgram(fd, "")
eb.Run(func(b *testing.B) {
// exercise programs here
})
}
The results per program will be output in the standard go benchmark format.
goos: linux
goarch: amd64
pkg: github.com/DataDog/bench-example
BenchmarkExample/eBPF-4 66741 20344 ns/op
BenchmarkExample/eBPF/kprobe/sys_bind 1 568 ns/op
BenchmarkExample/eBPF/kprobe/sys_socket 3 1110 ns/op
BenchmarkExample/eBPF/kprobe/tcp_cleanup_rbuf 266952 295 ns/op
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
create new ebpf benchmark with sysctl proc file.
No description provided by the author
# Variables
No description provided by the author
# Structs
No description provided by the author
No description provided by the author