Help us shape the future of Go! Take the 2026 Go Developer Survey

process

package
v1.21.77 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvironmentOptions

type EnvironmentOptions struct {
	Keys     []string
	Prefixes []string
}

type Process

type Process struct {
	PID              int               `json:"pid"`
	PPID             int               `json:"ppid,omitempty"`
	Status           string            `json:"status,omitempty"`
	Active           bool              `json:"active"`
	CPUPercent       float64           `json:"cpuPercent,omitempty"`
	MemoryPercent    float64           `json:"memoryPercent,omitempty"`
	RSSBytes         uint64            `json:"rssBytes,omitempty"`
	IO               *ProcessIO        `json:"io,omitempty"`
	StartedAt        *time.Time        `json:"startedAt,omitempty"`
	Command          string            `json:"command,omitempty"`
	CWD              string            `json:"cwd,omitempty"`
	CWDError         string            `json:"cwdError,omitempty"`
	Environment      map[string]string `json:"environment,omitempty"`
	EnvironmentError string            `json:"environmentError,omitempty"`
}

type ProcessIO added in v1.21.72

type ProcessIO struct {
	DiskReadBytes  uint64 `json:"diskReadBytes"`
	DiskWriteBytes uint64 `json:"diskWriteBytes"`
}

type ResourceUsage

type ResourceUsage struct {
	CPUPercent    float64   `json:"cpuPercent"`
	MemoryPercent float64   `json:"memoryPercent"`
	RSSBytes      uint64    `json:"rssBytes"`
	Processes     []Process `json:"processes,omitempty"`
}

type Snapshot

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

func Discover

func Discover(ctx context.Context, opts SnapshotOptions) (*Snapshot, error)

func NewSnapshot

func NewSnapshot(processes []Process) *Snapshot

func (*Snapshot) AggregateSubtree

func (s *Snapshot) AggregateSubtree(pid int) ResourceUsage

func (*Snapshot) All

func (s *Snapshot) All() []Process

func (*Snapshot) Ancestors

func (s *Snapshot) Ancestors(pid int) []Process

func (*Snapshot) Get

func (s *Snapshot) Get(pid int) (Process, bool)

func (*Snapshot) PopulateIO added in v1.21.72

func (s *Snapshot) PopulateIO(ctx context.Context, pids []int) error

func (*Snapshot) PopulateWorkingDirectories

func (s *Snapshot) PopulateWorkingDirectories(ctx context.Context, pids []int)

func (*Snapshot) Subtree

func (s *Snapshot) Subtree(pid int) []Process

type SnapshotOptions

type SnapshotOptions struct {
	Environment *EnvironmentOptions
}

Jump to

Keyboard shortcuts

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