cgroups

package
v0.1.0-proto2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(cgPath string, pid int) error

Add moves a PID into the cgroup

func Cleanup

func Cleanup(name string) error

Cleanup removes the cgroup

func Create

func Create(name string, spec ResourceSpec) (string, error)

Create creates a new cgroup and sets limits

func Setup

func Setup() error

Setup prepares the root cgroup for delegation. It moves the current process (gapid) into 'gapid-infra/supervisor'. Then it enables controllers (+cpu +memory) in 'gapid-infra'.

Types

type ResourceSpec

type ResourceSpec struct {
	CPU    float64 // 0.5 = 50%
	Memory int64   // Bytes
}

ResourceSpec defines limits

type Stats

type Stats struct {
	CPUUsage    float64 // Percentage (0-100)
	MemoryUsage int64   // Bytes
}

Stats holds resource usage statistics

func GetStats

func GetStats(name string) (Stats, error)

GetStats reads current resource usage from a cgroup

Jump to

Keyboard shortcuts

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