Documentation
¶
Overview ¶
Package processinfo reads a small, command-free snapshot of an operating system process. It is intended for status displays, so an already-exited PID is reported as Alive=false rather than as a fatal error.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupported = errors.New("native process metrics are not supported on this operating system")
ErrUnsupported indicates that native process metrics are unavailable on the current operating system.
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct {
PID int `json:"pid"`
Name string `json:"name"`
RSSBytes uint64 `json:"rss_bytes"`
StartTime time.Time `json:"start_time"`
Uptime time.Duration `json:"uptime_ns"`
Alive bool `json:"alive"`
}
Metrics is a read-only point-in-time process snapshot.
func Read ¶
Read returns native metrics for pid without invoking an external command. A PID that has already exited returns Metrics{Alive:false} and a nil error. Permission and malformed operating-system data errors remain visible so a caller can show actionable diagnostics without treating them as app-fatal.