procstat

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package procstat reads live process statistics from the operating system.

The observations are best effort: a zero value means the platform could not answer, never that the process used no memory. Callers that publish a metric must treat zero as "unknown" and say so.

Index

Constants

This section is empty.

Variables

View Source
var ErrProcessListUnsupported = errors.New("procstat: this platform cannot enumerate processes")

ErrProcessListUnsupported reports that this build cannot enumerate processes. It is a declared limitation rather than an empty answer: a command that stops processes must not report success because it could not see any.

Functions

func ResidentBytes

func ResidentBytes(pid int) int64

ResidentBytes returns the current resident set size of pid in bytes, or 0 when the platform cannot report it.

Types

type Process

type Process struct {
	PID  int
	Args []string
}

Process is one live process, named by the arguments it was started with.

Only processes this user can read are listed. Enumerating another user's arguments needs privileges this tool does not want, and a process it cannot read is one it could not signal either.

func List

func List() ([]Process, error)

List returns every process of this user that the platform can describe.

func (Process) Command

func (process Process) Command() string

Command answers the process's argv joined for a report, or its identifier when the platform gave no arguments.

func (Process) Invocation

func (process Process) Invocation() (program, command string)

Invocation reports the executable's base name and its first argument, which is what distinguishes `kivgraph serve` from `kivgraph index`.

Jump to

Keyboard shortcuts

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