system

package
v0.0.0-...-fd5e59c Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartSampler

func StartSampler(interval time.Duration)

StartSampler starts a background goroutine that samples per-core CPU usage at the given interval. Call once at startup before serving requests.

Types

type CPUInfo

type CPUInfo struct {
	Model     string    `json:"model"`
	Cores     int       `json:"cores"`
	Speed     float64   `json:"speed"`
	Usage     float64   `json:"usage"`
	CoreUsage []float64 `json:"coreUsage"`
}

type DiskInfo

type DiskInfo struct {
	Filesystem string `json:"filesystem"`
	Size       uint64 `json:"size"`
	Used       uint64 `json:"used"`
	MountedOn  string `json:"mountedOn"`
}

type MemoryInfo

type MemoryInfo struct {
	Free      uint64 `json:"free"`
	Available uint64 `json:"available"`
	Used      uint64 `json:"used"`
	Total     uint64 `json:"total"`
}

type SystemInfo

type SystemInfo struct {
	Uptime    int64      `json:"uptime"`
	Timestamp string     `json:"timestamp"`
	CPU       CPUInfo    `json:"cpu"`
	Memory    MemoryInfo `json:"memory"`
	Disk      []DiskInfo `json:"disk"`
}

func MeasureSystem

func MeasureSystem() (SystemInfo, error)

Jump to

Keyboard shortcuts

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