execinfomanager

package
v0.0.0-...-3b12f0d Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutableInfo

type ExecutableInfo struct {
	// Data stores per-executable interpreter information if the file ID that this
	// instance belongs to was previously identified as an interpreter. Otherwise,
	// this field is nil.
	Data interpreter.Data
	// TSDInfo stores TSD information if the executable is libc, otherwise nil.
	TSDInfo *tpbase.TSDInfo
}

ExecutableInfo stores information about an executable (ELF file).

type ExecutableInfoManager

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

ExecutableInfoManager manages all per-executable (FileID) information that we require to perform our native and interpreter unwinding. Executable information is de-duplicated between processes and is kept around as long as there is at least one process that is known to have the corresponding FileID loaded (reference counting). Tracking loaded executables is left to the caller.

The manager is synchronized internally and all public methods can be called from an arbitrary number of threads simultaneously.

The manager is responsible for managing entries in the following BPF maps:

- stack_delta_page_to_info - exe_id_to_%d_stack_deltas - unwind_info_array - interpreter_offsets

All of these maps can be read by anyone, but are written to exclusively by this manager.

func NewExecutableInfoManager

func NewExecutableInfoManager(
	sdp nativeunwind.StackDeltaProvider,
	ebpf pmebpf.EbpfHandler,
	includeTracers []bool,
) *ExecutableInfoManager

NewExecutableInfoManager creates a new instance of the executable info manager.

func (*ExecutableInfoManager) AddOrIncRef

func (mgr *ExecutableInfoManager) AddOrIncRef(fileID host.FileID,
	elfRef *pfelf.Reference) (ExecutableInfo, error)

AddOrIncRef either adds information about an executable to the internal cache (when first encountering it) or increments the reference count if the executable is already known.

The return value is copied instead of returning a pointer in order to spare us the use of getters and more complicated locking semantics.

func (*ExecutableInfoManager) AddSynthIntervalData

func (mgr *ExecutableInfoManager) AddSynthIntervalData(
	fileID host.FileID,
	data sdtypes.IntervalData,
) error

AddSynthIntervalData should only be called once for a given file ID. It will error if it or AddOrIncRef has been previously called for the same file ID. Interpreter detection is skipped.

func (*ExecutableInfoManager) NumInterpreterLoaders

func (mgr *ExecutableInfoManager) NumInterpreterLoaders() int

NumInterpreterLoaders returns the number of interpreter loaders that are enabled.

func (*ExecutableInfoManager) RemoveOrDecRef

func (mgr *ExecutableInfoManager) RemoveOrDecRef(fileID host.FileID) error

RemoveOrDecRef decrements the reference counter of the executable being tracked. Once the RC reaches zero, information about the file is removed from the manager and the corresponding BPF maps.

func (*ExecutableInfoManager) UpdateMetricSummary

func (mgr *ExecutableInfoManager) UpdateMetricSummary(summary metrics.Summary)

UpdateMetricSummary updates the metrics in the given metric map.

Jump to

Keyboard shortcuts

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