memory

package
v1.37.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package memory provides session memory measurement for the hibernation sweeper.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GopsutilReader

type GopsutilReader struct{}

GopsutilReader implements Reader using gopsutil and tmux.

func NewGopsutilReader

func NewGopsutilReader() *GopsutilReader

NewGopsutilReader creates a new GopsutilReader.

func (*GopsutilReader) SessionRSSMB

func (g *GopsutilReader) SessionRSSMB(tmuxSessionName string) (int64, error)

SessionRSSMB returns the summed RSS in MB for all processes in a tmux session.

func (*GopsutilReader) SystemMemoryPct

func (g *GopsutilReader) SystemMemoryPct() (float64, error)

SystemMemoryPct returns used memory percentage via gopsutil.

type Reader

type Reader interface {
	// SystemMemoryPct returns the percentage of system RAM in use (0–100).
	// Returns 0 on platforms where measurement is unavailable.
	SystemMemoryPct() (float64, error)
	// SessionRSSMB returns the total RSS (resident set size) in MB for all
	// processes belonging to the given tmux session name.
	// Returns 0 if the session is not running or measurement fails.
	SessionRSSMB(tmuxSessionName string) (int64, error)
}

Reader reports system and per-session memory usage.

Directories

Path Synopsis
Package memorytest provides test doubles for the memory package.
Package memorytest provides test doubles for the memory package.

Jump to

Keyboard shortcuts

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