lock_bpfel.go - Katyusha's blog
mobile wallpaper 1mobile wallpaper 2mobile wallpaper 3mobile wallpaper 4
lock_bpfel.go
Go Source File · 144 lines
lock_bpfel.go
// Code generated by bpf2go; DO NOT EDIT.
//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64
package collector
import (
"bytes"
_ "embed"
"fmt"
"io"
"github.com/cilium/ebpf"
)
type lockLockStat struct {
OffcpuNs uint64
OffcpuCount uint64
MaxOffcpuNs uint64
LastWaker uint32
Stackid int32
Comm [16]int8
}
type lockOffcpuInfo struct {
Ts uint64
Stackid int32
Pad uint32
}
// loadLock returns the embedded CollectionSpec for lock.
func loadLock() (*ebpf.CollectionSpec, error) {
reader := bytes.NewReader(_LockBytes)
spec, err := ebpf.LoadCollectionSpecFromReader(reader)
if err != nil {
return nil, fmt.Errorf("can't load lock: %w", err)
}
return spec, err
}
// loadLockObjects loads lock and converts it into a struct.
//
// The following types are suitable as obj argument:
//
// *lockObjects
// *lockPrograms
// *lockMaps
//
// See ebpf.CollectionSpec.LoadAndAssign documentation for details.
func loadLockObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
spec, err := loadLock()
if err != nil {
return err
}
return spec.LoadAndAssign(obj, opts)
}
// lockSpecs contains maps and programs before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type lockSpecs struct {
lockProgramSpecs
lockMapSpecs
}
// lockSpecs contains programs before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type lockProgramSpecs struct {
HandleSwitch *ebpf.ProgramSpec `ebpf:"handle_switch"`
HandleWakeup *ebpf.ProgramSpec `ebpf:"handle_wakeup"`
}
// lockMapSpecs contains maps before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type lockMapSpecs struct {
LockStats *ebpf.MapSpec `ebpf:"lock_stats"`
OffcpuStart *ebpf.MapSpec `ebpf:"offcpu_start"`
Stackmap *ebpf.MapSpec `ebpf:"stackmap"`
}
// lockObjects contains all objects after they have been loaded into the kernel.
//
// It can be passed to loadLockObjects or ebpf.CollectionSpec.LoadAndAssign.
type lockObjects struct {
lockPrograms
lockMaps
}
func (o *lockObjects) Close() error {
return _LockClose(
&o.lockPrograms,
&o.lockMaps,
)
}
// lockMaps contains all maps after they have been loaded into the kernel.
//
// It can be passed to loadLockObjects or ebpf.CollectionSpec.LoadAndAssign.
type lockMaps struct {
LockStats *ebpf.Map `ebpf:"lock_stats"`
OffcpuStart *ebpf.Map `ebpf:"offcpu_start"`
Stackmap *ebpf.Map `ebpf:"stackmap"`
}
func (m *lockMaps) Close() error {
return _LockClose(
m.LockStats,
m.OffcpuStart,
m.Stackmap,
)
}
// lockPrograms contains all programs after they have been loaded into the kernel.
//
// It can be passed to loadLockObjects or ebpf.CollectionSpec.LoadAndAssign.
type lockPrograms struct {
HandleSwitch *ebpf.Program `ebpf:"handle_switch"`
HandleWakeup *ebpf.Program `ebpf:"handle_wakeup"`
}
func (p *lockPrograms) Close() error {
return _LockClose(
p.HandleSwitch,
p.HandleWakeup,
)
}
func _LockClose(closers ...io.Closer) error {
for _, closer := range closers {
if err := closer.Close(); err != nil {
return err
}
}
return nil
}
// Do not access this directly.
//
//go:embed lock_bpfel.o
var _LockBytes []byte

目录