process

package
v0.30.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProcessMapNotFound = errors.New("perf-map not found")
	ErrProcNotFound       = errors.New("process not found")
)

Functions

This section is empty.

Types

type Cache added in v0.20.0

type Cache[K comparable, V any] interface {
	Add(key K, value V)
	Get(key K) (V, bool)
	Peek(key K) (V, bool)
	Remove(key K)
}

type DebuginfoManager added in v0.20.0

type DebuginfoManager interface {
	ShouldInitiateUpload(ctx context.Context, buildID string) (bool, error)
	UploadMapping(ctx context.Context, m *Mapping) error
	Close() error
}

type Info added in v0.20.0

type Info struct {

	// - Unwind Information
	Interpreter *runtime.Interpreter
	Mappings    Mappings
	// contains filtered or unexported fields
}

func (Info) Labels added in v0.20.0

func (i Info) Labels(ctx context.Context) (model.LabelSet, error)

type InfoManager added in v0.20.0

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

func NewInfoManager added in v0.20.0

func NewInfoManager(
	logger log.Logger,
	tracer trace.Tracer,
	reg prometheus.Registerer,
	proceFS procfs.FS,
	objFilePool *objectfile.Pool,
	mm *MapManager,
	dim DebuginfoManager,
	lm LabelManager,
	profilingDuration time.Duration,
	cacheTTL time.Duration,
) *InfoManager

func (*InfoManager) Close added in v0.20.0

func (im *InfoManager) Close() error

func (*InfoManager) Fetch added in v0.20.0

func (im *InfoManager) Fetch(ctx context.Context, pid int) (Info, error)

func (*InfoManager) FetchWithFreshMappings added in v0.27.0

func (im *InfoManager) FetchWithFreshMappings(ctx context.Context, pid int) (Info, error)

func (*InfoManager) Info added in v0.20.0

func (im *InfoManager) Info(ctx context.Context, pid int) (Info, error)

Info returns the cached information for the given process.

func (*InfoManager) Run added in v0.20.0

func (im *InfoManager) Run(ctx context.Context) error

type LabelManager added in v0.20.0

type LabelManager interface {
	Fetch(ctx context.Context, pid int) error
	LabelSet(ctx context.Context, pid int) (model.LabelSet, error)
}

TODO: Unify PID types.

type MapManager added in v0.20.0

type MapManager struct {
	procfs.FS
	// contains filtered or unexported fields
}

func NewMapManager added in v0.20.0

func NewMapManager(
	reg prometheus.Registerer,
	fs procfs.FS,
	objFilePool *objectfile.Pool,
) *MapManager

func (*MapManager) MappingsForPID added in v0.20.0

func (mm *MapManager) MappingsForPID(pid int) (Mappings, error)

MappingsForPID returns all the mappings for the given PID.

func (*MapManager) NewUserMapping added in v0.24.0

func (mm *MapManager) NewUserMapping(pm *procfs.ProcMap, pid int) (*Mapping, error)

newUserMapping makes sure the mapped file is open and computes the kernel offset.

type Mapping

type Mapping struct {
	*procfs.ProcMap

	// Process related fields.
	PID int

	// This will be populated if mappping has executable and symbolizable.
	// We intentionally do NOT use an ObjectFile here.
	// So that it could be GCed and closed.
	// This is needed for pprof conversion.
	BuildID string

	IsJITDump bool

	// This mapping had no path associated with it. Usually this means the
	// mapping is a JIT compiled section.
	NoFileMapping bool
	// contains filtered or unexported fields
}

func (*Mapping) AbsolutePath added in v0.20.0

func (m *Mapping) AbsolutePath() string

AbsolutePath returns path relative to the root namespace of the system.

func (*Mapping) ExecutableInfo added in v0.24.0

func (m *Mapping) ExecutableInfo(addr uint64) (*profilestorepb.ExecutableInfo, error)

Normalize converts the given address to the address relative to the start of the object file.

func (*Mapping) Normalize added in v0.20.0

func (m *Mapping) Normalize(addr uint64) (uint64, error)

func (*Mapping) Root added in v0.20.0

func (m *Mapping) Root() string

Root returns the root filesystem of the process that owns the mapping.

type Mappings added in v0.20.0

type Mappings []*Mapping

func (Mappings) ConvertToPprof added in v0.20.0

func (ms Mappings) ConvertToPprof() []*profile.Mapping

func (Mappings) Executables added in v0.27.0

func (ms Mappings) Executables() []*Mapping

func (Mappings) Hash added in v0.27.0

func (ms Mappings) Hash() (uint64, error)

Hash produces a summary of the raw mappings. It only hashes the raw mappings, not the bookkeeping information.

type Tree added in v0.13.0

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

func NewTree added in v0.13.0

func NewTree(
	logger log.Logger,
	procfs procfs.FS,
	maxUpdateInterval time.Duration,
) *Tree

NewTree returns a new process tree with current state of all the processes on the system.

func (*Tree) FindAllAncestorProcessIDsInSameCgroup added in v0.13.0

func (t *Tree) FindAllAncestorProcessIDsInSameCgroup(pid int) ([]int, error)

FindAllAncestorProcessIDsInSameCgroup returns all ancestor process IDs for a given PID in the same cgroup.

func (*Tree) Run added in v0.13.0

func (t *Tree) Run(ctx context.Context) error

Run starts the process tree and update it periodically.

Jump to

Keyboard shortcuts

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