offcpu

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Profiler

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

Profiler handles off-CPU profiling with stack traces

func NewProfiler

func NewProfiler(pid int, systemWide bool, tags []string, labels map[string]string, sym symbolize.Symbolizer, kernelSym symbolize.KernelSymbolizer, kernelStacks bool) (*Profiler, error)

NewProfiler creates a new off-CPU profiler.

kernelStacks gates the BPF program's kernel-stack capture (set from cfg.KernelStacks). When false, kernel-stack capture is fully bypassed at sample time. The off-CPU FP profiler has no per-PID pid_config setter, so the gate lives entirely in the BPF program.

func (*Profiler) Close

func (pr *Profiler) Close()

Close releases all resources associated with the profiler. The symbolizer is owned by the Agent; we do not close it here.

func (*Profiler) Collect

func (pr *Profiler) Collect(w io.Writer) error

Collect writes the profile to the provided writer (supports streaming). The output is gzip-compressed pprof data.

func (*Profiler) CollectAndWrite

func (pr *Profiler) CollectAndWrite(outputPath string) error

CollectAndWrite collects samples and writes the profile to the specified path. This is a convenience wrapper around Collect for file-based output.