profiling

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupport = fmt.Errorf("not support")
View Source
var (
	KernelSymbolFilePath = "/proc/kallsyms"
)

Functions

This section is empty.

Types

type GoLibrary

type GoLibrary struct {
}

GoLibrary is using build-in elf reader to read

func NewGoLibrary

func NewGoLibrary() *GoLibrary

func (*GoLibrary) AnalyzeSymbols

func (l *GoLibrary) AnalyzeSymbols(filePath string) ([]*Symbol, error)

func (*GoLibrary) IsSupport

func (l *GoLibrary) IsSupport(filePath string) bool

func (*GoLibrary) ToModule

func (l *GoLibrary) ToModule(pid int32, modName, modPath string, moduleRange []*ModuleRange) (*Module, error)

type Info

type Info struct {
	Modules []*Module
	// contains filtered or unexported fields
}

Info of profiling process

func NewInfo

func NewInfo(modules map[string]*Module) *Info

func (*Info) FindMultipleSymbolByRegex added in v0.6.0

func (i *Info) FindMultipleSymbolByRegex(rep string) ([]string, error)

func (*Info) FindSymbolAddress added in v0.3.0

func (i *Info) FindSymbolAddress(name string) uint64

func (*Info) FindSymbolByRegex added in v0.4.0

func (i *Info) FindSymbolByRegex(rep string) (string, error)

func (*Info) FindSymbolName

func (i *Info) FindSymbolName(address uint64) string

FindSymbolName by address

func (*Info) FindSymbols

func (i *Info) FindSymbols(addresses []uint64, defaultSymbol string) []string

FindSymbols from address list, if could not found symbol name then append default symbol to array

type KernelFinder

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

func NewKernelFinder

func NewKernelFinder() *KernelFinder

func (*KernelFinder) Analyze

func (k *KernelFinder) Analyze(filepath string) (*Info, error)

func (*KernelFinder) IsSupport

func (k *KernelFinder) IsSupport(filepath string) bool

type Module

type Module struct {
	Ranges           []*ModuleRange
	Name             string
	Path             string
	Type             ModuleType
	SoOffset, SoAddr uint64
	Symbols          []*Symbol
}

type ModuleRange

type ModuleRange struct {
	StartAddr, EndAddr, FileOffset uint64
}

type ModuleType

type ModuleType int8
const (
	ModuleTypeExec ModuleType = iota
	ModuleTypeSo
	ModuleTypePerfMap
	ModuleTypeVDSO
	ModuleTypeUnknown
)

type NotSupport

type NotSupport struct {
}

func NewNotSupport

func NewNotSupport() *NotSupport

func (*NotSupport) AnalyzeSymbols

func (l *NotSupport) AnalyzeSymbols(filePath string) ([]*Symbol, error)

func (*NotSupport) IsSupport

func (l *NotSupport) IsSupport(filePath string) bool

func (*NotSupport) ToModule

func (l *NotSupport) ToModule(pid int32, modName, modPath string, moduleRange []*ModuleRange) (*Module, error)

type StatFinder

type StatFinder interface {
	// IsSupport to stat the executable file for profiling
	IsSupport(filePath string) bool
	// AnalyzeSymbols in the file
	AnalyzeSymbols(filePath string) ([]*Symbol, error)
	// ToModule to init a new module
	ToModule(pid int32, modName, modPath string, moduleRange []*ModuleRange) (*Module, error)
}

type Symbol

type Symbol struct {
	Name     string
	Location uint64
	Size     uint64
}

Symbol of executable file

Jump to

Keyboard shortcuts

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