Documentation
¶
Overview ¶
Package process provides process management operations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Darwin ¶
type Darwin struct{}
Darwin implements the Provider interface for Darwin (macOS). All methods return ErrUnsupported as process management is not available on macOS.
func NewDarwinProvider ¶
func NewDarwinProvider() *Darwin
NewDarwinProvider factory to create a new Darwin instance.
type Debian ¶
type Debian struct {
provider.FactsAware
// contains filtered or unexported fields
}
Debian implements the Provider interface for Debian-family systems.
func NewDebianProvider ¶
NewDebianProvider factory to create a new Debian instance.
type Info ¶
type Info struct {
PID int `json:"pid"`
Name string `json:"name"`
User string `json:"user"`
State string `json:"state"`
CPUPercent float64 `json:"cpu_percent"`
MemPercent float32 `json:"mem_percent"`
MemRSS int64 `json:"mem_rss"`
Command string `json:"command"`
StartTime string `json:"start_time"`
}
Info represents a running process.
type Item ¶
Item pairs a PID with a Querier. PID is exposed separately because gopsutil.Process.Pid is a struct field, which interfaces cannot express.
type Linux ¶
type Linux struct{}
Linux implements the Provider interface for generic Linux. All methods return ErrUnsupported as this is a generic Linux stub.
func NewLinuxProvider ¶
func NewLinuxProvider() *Linux
NewLinuxProvider factory to create a new Linux instance.
type Lister ¶
Lister provides methods to list and look up processes.
func NewGopsutilLister ¶
func NewGopsutilLister() Lister
NewGopsutilLister returns the real gopsutil-backed Lister.
type Provider ¶
type Provider interface {
// List returns all running processes.
List(ctx context.Context) ([]Info, error)
// Get returns details for a specific process by PID.
Get(ctx context.Context, pid int) (*Info, error)
// Signal sends a signal to a process by PID.
Signal(ctx context.Context, pid int, signal string) (*SignalResult, error)
}
Provider implements process management operations.
type Querier ¶
type Querier interface {
Name() (string, error)
Username() (string, error)
Status() ([]string, error)
CPUPercent() (float64, error)
MemoryPercent() (float32, error)
MemoryInfo() (*gopsutil.MemoryInfoStat, error)
Cmdline() (string, error)
CreateTime() (int64, error)
}
Querier provides methods to query a single process. *gopsutil.Process satisfies this interface.