process

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Follow

func Follow(path string, out chan<- string, stop <-chan struct{}) error

Follow streams new lines from a file by polling, sending each line to the out channel. Returns when ctx is done.

func PidAlive

func PidAlive(pid int) bool

PidAlive reports whether a process with the given PID is still running. Returns false on any error (including permission errors on platforms where we can't tell).

func TailLines

func TailLines(path string, n int) ([]string, error)

TailLines reads the last n lines from a file.

Types

type ProcessStats

type ProcessStats struct {
	PID        int
	CPUPercent float64
	MemoryMB   float64
	Status     string
}

func GetStats

func GetStats(pid int) (*ProcessStats, error)

GetStats returns CPU and memory usage for a given PID.

Jump to

Keyboard shortcuts

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