processinfo

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 7 Imported by: 0

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

View Source
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

func Read(pid int) (Metrics, error)

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.

Jump to

Keyboard shortcuts

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