gvisorgvisor.dev/gvisor/runsc/profile Index | Files

package profile

import "gvisor.dev/gvisor/runsc/profile"

Package profile contains profiling utils.

Index

Functions

func Start

func Start(opts Opts) func()

Start starts profiling for the given Kinds in opts, and writes the profile data to the corresponding FDs in opts. It returns a function which will stop profiling.

func UpdatePaths

func UpdatePaths(conf *config.Config, timestamp time.Time)

UpdatePaths updates profiling-related file paths in the given config.

Types

type FDArgs

type FDArgs struct {
	// BlockFD is the file descriptor to write a block profile to.
	// Valid if >=0.
	BlockFD int
	// CPUFD is the file descriptor to write a CPU profile to.
	// Valid if >=0.
	CPUFD int
	// HeapFD is the file descriptor to write a heap profile to.
	// Valid if >=0.
	HeapFD int
	// MutexFD is the file descriptor to write a mutex profile to.
	// Valid if >=0.
	MutexFD int
	// TraceFD is the file descriptor to write a Go execution trace to.
	// Valid if >=0.
	TraceFD int
}

FDArgs are the arguments that describe which profiles to enable and which FDs to write them to. Profiling of a given type will only be enabled if the corresponding FD is >=0.

func (*FDArgs) SetFromFlags

func (fds *FDArgs) SetFromFlags(f *flag.FlagSet)

SetFromFlags sets the FDArgs from the given flags. The default value for each FD is -1.

func (*FDArgs) ToOpts

func (fds *FDArgs) ToOpts() Opts

ToOpts turns FDArgs into an Opts struct which can be passed to Start.

type Kind

type Kind int

Kind is the kind of profiling to perform.

const (
	// Block profile.
	Block Kind = iota
	// CPU profile.
	CPU
	// Heap profile.
	Heap
	// Mutex profile.
	Mutex
	// Trace profile.
	Trace
)

type Opts

type Opts map[Kind]uintptr

Opts is a map of profile Kind to FD.

Source Files

profile.go

Version
v0.0.0-20250605235530-a6711d1e1dc6 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
11 packages
Last checked
29 minutes ago

Tools for package owners.