cpu

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SCHED_CACHE_SIZE      = 512
	SCHED_CACHE_DUMP_STEP = 10
)

Variables

This section is empty.

Functions

func NewFutexSnoopSession

func NewFutexSnoopSession(name string, cfg *config.FUTEXSNOOP, buf chan *model.SpyEvent) core.BpfSpyer

func NewOffCpuBpfSession

func NewOffCpuBpfSession(name string, cfg *config.OFFCPU, buf chan *model.SpyEvent) core.BpfSpyer

func NewOnCpuBpfSession

func NewOnCpuBpfSession(name string, cfg *config.ONCPU, buf chan *model.SpyEvent) core.BpfSpyer

func NewSyscallSession

func NewSyscallSession(name string, cfg *config.SYSCALL, buf chan *model.SpyEvent) core.BpfSpyer

func SyscallNameToId

func SyscallNameToId(name string) uint32

Types

type BpfSession

type BpfSession struct {
	Session *core.Session
	// inner field
	PerfBuffer *bpf.PerfBuffer
	// inner field
	Module *bpf.Module
}

func (*BpfSession) ConsumeEvent

func (s *BpfSession) ConsumeEvent() error

func (*BpfSession) Name

func (s *BpfSession) Name() string

func (*BpfSession) Start

func (s *BpfSession) Start() error

func (*BpfSession) Stop

func (s *BpfSession) Stop() error

type FutexSnoopArgs

type FutexSnoopArgs struct {
	Tid              uint32
	Pid              uint32
	TargetLock       uint64
	Stack            bool
	MinDurMs         uint32
	MaxDurMs         uint32
	MaxLockHoldUsers uint32
}

type FutexSnoopSession

type FutexSnoopSession struct {
	Session    *core.Session
	PerfBuffer *bpf.PerfBuffer
	Module     *bpf.Module
	SymSession *symtab.SymSession

	Args    FutexSnoopArgs
	BtfPath string
	// contains filtered or unexported fields
}

func (*FutexSnoopSession) ConsumeEvent

func (b *FutexSnoopSession) ConsumeEvent() error

func (*FutexSnoopSession) HandleEvent

func (b *FutexSnoopSession) HandleEvent(data []byte)

func (*FutexSnoopSession) Name

func (b *FutexSnoopSession) Name() string

func (*FutexSnoopSession) ReadEvent

func (b *FutexSnoopSession) ReadEvent() error

func (*FutexSnoopSession) ResolveStack

func (b *FutexSnoopSession) ResolveStack(syms *bytes.Buffer, stackId int32, pid uint32, userspace bool) error

func (*FutexSnoopSession) Start

func (b *FutexSnoopSession) Start() error

func (*FutexSnoopSession) Stop

func (b *FutexSnoopSession) Stop() error

type LockStat

type LockStat struct {
	UserCnt    uint32
	MaxUserCnt uint32
	Uaddr      uint64
	Comm       [16]byte
	PidTgid    uint64
	Ts         uint64
}

type OffCpuArgs

type OffCpuArgs struct {
	Pid           uint32
	Tgid          uint32
	Min_offcpu_ms uint32
	Max_offcpu_ms uint32
	Rq_dur_ms     uint32
}

type OffCpuEvent

type OffCpuEvent struct {
	Waker            Waker
	Target           Target
	Dur_ms           uint64
	Rq_dur_ms        uint64
	Ts_ns            uint64
	IsSchedCacheDump uint32
	Cpu              uint32
}

type OffcpuSession

type OffcpuSession struct {
	Session *core.Session
	// inner filed
	PerfBuffer *bpf.PerfBuffer
	// inner filed
	Module     *bpf.Module
	SymSession *symtab.SymSession

	Args    OffCpuArgs
	BtfPath string
	// contains filtered or unexported fields
}

func (*OffcpuSession) ConsumeEvent

func (b *OffcpuSession) ConsumeEvent() error

func (*OffcpuSession) HandleEvent

func (b *OffcpuSession) HandleEvent(data []byte)

func (*OffcpuSession) Name

func (b *OffcpuSession) Name() string

func (*OffcpuSession) ReadEvent

func (b *OffcpuSession) ReadEvent() error

func (*OffcpuSession) ResolveStack

func (b *OffcpuSession) ResolveStack(syms *bytes.Buffer, stackId int32, pid uint32, userspace bool) error

func (*OffcpuSession) Start

func (b *OffcpuSession) Start() error

func (*OffcpuSession) Stop

func (b *OffcpuSession) Stop() error

type OnCpuArgs

type OnCpuArgs struct {
	// contains filtered or unexported fields
}

type OnCpuEvent

type OnCpuEvent struct {
	Pid       uint32
	KernStack int64
	UserStack int64
	Comm      [16]byte
}

type OncpuSession

type OncpuSession struct {
	Session *core.Session
	// inner filed
	PerfBuffer *bpf.PerfBuffer
	// inner filed
	Module     *bpf.Module
	SymSession *symtab.SymSession

	BtfPath string
	// contains filtered or unexported fields
}

func (*OncpuSession) ConsumeEvent

func (b *OncpuSession) ConsumeEvent() error

func (*OncpuSession) HandleEvent

func (b *OncpuSession) HandleEvent(data []byte)

func (*OncpuSession) Name

func (b *OncpuSession) Name() string

func (*OncpuSession) PollData

func (b *OncpuSession) PollData()

func (*OncpuSession) ReadEvent

func (b *OncpuSession) ReadEvent() error

func (*OncpuSession) Reset

func (b *OncpuSession) Reset() error

func (*OncpuSession) ResolveStack

func (b *OncpuSession) ResolveStack(syms *bytes.Buffer, stackId int32, pid uint32, userspace bool) error

func (*OncpuSession) Start

func (b *OncpuSession) Start() error

func (*OncpuSession) Stop

func (b *OncpuSession) Stop() error

type SchedCached

type SchedCached struct {
	Status  uint32
	Cpu     uint32
	Id      uint32
	Pad     uint32
	Records [SCHED_CACHE_SIZE]SchedRecord
}

type SchedRecord

type SchedRecord struct {
	Pid  uint32
	Prio uint32
	Comm [16]byte
	Ts   uint64
}

type SyscallArgs

type SyscallArgs struct {
	Pid       uint32
	Tid       uint32
	MinDurMs  uint32
	MaxDurMs  uint32
	Stack     bool
	SyscallId uint32
}

type SyscallEvent

type SyscallEvent struct {
	Pid       uint32
	Tid       uint32
	TsNs      uint64
	DurUs     uint64
	UStackId  int64
	KStackId  int64
	SyscallId uint32
	Comm      [16]byte
}

type SyscallSession

type SyscallSession struct {
	Session    *core.Session
	PerfBuffer *bpf.PerfBuffer
	Module     *bpf.Module
	SymSession *symtab.SymSession

	Args    SyscallArgs
	BtfPath string
	Arch    string
	// contains filtered or unexported fields
}

func (*SyscallSession) ConsumeEvent

func (b *SyscallSession) ConsumeEvent() error

func (*SyscallSession) HandleEvent

func (b *SyscallSession) HandleEvent(data []byte)

func (*SyscallSession) Name

func (b *SyscallSession) Name() string

func (*SyscallSession) ReadEvent

func (b *SyscallSession) ReadEvent() error

func (*SyscallSession) ResolveStack

func (b *SyscallSession) ResolveStack(syms *bytes.Buffer, stackId int32, pid uint32, userspace bool) error

func (*SyscallSession) Start

func (b *SyscallSession) Start() error

func (*SyscallSession) Stop

func (b *SyscallSession) Stop() error

func (*SyscallSession) SyscallIdToName

func (b *SyscallSession) SyscallIdToName(id uint32) string

type Target

type Target struct {
	Pid           uint32
	Tgid          uint32
	W_pid         uint32
	Pad           uint32
	W_Comm        [16]byte
	User_stack_id int32
	Kern_stack_id int32
	Comm          [16]byte
	Oncpu_ns      uint64
	Offcpu_ns     uint64
	Onrq_ns       uint64
	Offcpu_id     uint32
	Oncpu_id      uint32
	Run_delay_ns  uint64
}

type TaskCounter

type TaskCounter struct {
	// contains filtered or unexported fields
}

type TaskLockStat

type TaskLockStat struct {
	Slots        [24]uint32
	Comm         [16]byte
	PidTgid      uint64
	Uaddr        uint64
	UserStackId  int32
	Pad          uint32
	Contended    uint64
	TotalElapsed uint64
	MinDur       uint64
	MaxDur       uint64
	DeltaDur     uint64
	MaxDurTs     uint64
}

type Waker

type Waker struct {
	Pid           uint32
	Tgid          uint32
	T_pid         uint32
	Pad           uint32
	T_Comm        [16]byte
	User_stack_id int32
	Kern_stack_id int32
	Comm          [16]byte
	Oncpu_ns      uint64
	Offcpu_ns     uint64
	Onrq_ns       uint64
	Offcpu_id     uint32
	Oncpu_id      uint32
	Run_delay_ns  uint64
}

Directories

Path Synopsis
This program demonstrates attaching an eBPF program to a kernel symbol.
This program demonstrates attaching an eBPF program to a kernel symbol.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL