tracer

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: 44 Imported by: 0

Documentation

Overview

Package tracer contains functionality for populating tracers.

Index

Constants

View Source
const (
	// ProbabilisticThresholdMax defines the upper bound of the probabilistic profiling
	// threshold.
	ProbabilisticThresholdMax = 100
)

Variables

This section is empty.

Functions

func GetCurrentKernelVersion

func GetCurrentKernelVersion() (major, minor, patch uint32, err error)

GetCurrentKernelVersion returns the major, minor and patch version of the kernel of the host from the utsname struct.

func ProbeBPFSyscall

func ProbeBPFSyscall() error

ProbeBPFSyscall checks if the syscall EBPF is available on the system.

func ProbeTracepoint

func ProbeTracepoint() error

ProbeTracepoint checks if tracepoints are available on the system, so we can attach our eBPF code there.

Types

type Intervals

type Intervals interface {
	MonitorInterval() time.Duration
	TracePollInterval() time.Duration
	PIDCleanupInterval() time.Duration
}

Intervals is a subset of config.IntervalsAndTimers.

type Tracer

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

Tracer provides an interface for loading and initializing the eBPF components as well as for monitoring the output maps for new traces and count updates.

func NewTracer

func NewTracer(ctx context.Context, rep reporter.SymbolReporter, intervals Intervals,
	includeTracers []bool, filterErrorFrames bool) (*Tracer, error)

NewTracer loads eBPF code and map definitions from the ELF module at the configured path.

func (*Tracer) AttachSchedMonitor

func (t *Tracer) AttachSchedMonitor() error

AttachSchedMonitor attaches a kprobe to the process scheduler. This hook detects the exit of a process and enables us to clean up data we associated with this process.

func (*Tracer) AttachTracer

func (t *Tracer) AttachTracer(sampleFreq int) error

AttachTracer attaches the main tracer entry point to the perf interrupt events. The tracer entry point is always the native tracer. The native tracer will determine when to invoke the interpreter tracers based on address range information.

func (*Tracer) Close

func (t *Tracer) Close()

Close provides functionality for Tracer to perform cleanup tasks. NOTE: Close may be called multiple times in succession.

func (*Tracer) ConvertTrace

func (t *Tracer) ConvertTrace(trace *host.Trace) *libpf.Trace

func (*Tracer) EnableProfiling

func (t *Tracer) EnableProfiling() error

EnableProfiling enables the perf interrupt events with the attached eBPF programs.

func (*Tracer) StartMapMonitors

func (t *Tracer) StartMapMonitors(ctx context.Context, traceOutChan chan *host.Trace) error

StartMapMonitors starts goroutines for collecting metrics and monitoring eBPF maps for tracepoints, new traces, trace count updates and unknown PCs.

func (*Tracer) StartPIDEventProcessor

func (t *Tracer) StartPIDEventProcessor(ctx context.Context) error

StartPIDEventProcessor spawns a goroutine to process PID events.

func (*Tracer) StartProbabilisticProfiling

func (t *Tracer) StartProbabilisticProfiling(ctx context.Context,
	interval time.Duration, threshold uint)

StartProbabilisticProfiling periodically runs probabilistic profiling.

func (*Tracer) SymbolizationComplete

func (t *Tracer) SymbolizationComplete(traceCaptureKTime libpf.KTime)

Jump to

Keyboard shortcuts

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