cgroup

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	V1 = iota
	V2
)
View Source
const UnifiedMountpoint = "/sys/fs/cgroup"

Variables

View Source
var (
	ErrCgroupNotFound = errors.New("cgroup not found")
)

Functions

func StatPSI added in v1.31.0

func StatPSI(dirPath string, file string) (*castaipb.PSIStats, error)

Types

type Cgroup

type Cgroup struct {
	Id               uint64
	ContainerRuntime ContainerRuntimeID
	ContainerID      string
	// contains filtered or unexported fields
}

func (*Cgroup) GetStats added in v1.31.0

func (cg *Cgroup) GetStats() (Stats, error)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(log *logging.Logger, root string, psiEnabled bool) (*Client, error)

func (*Client) CleanupCgroup added in v1.3.0

func (c *Client) CleanupCgroup(id ID)

func (*Client) DefaultCgroupVersion

func (c *Client) DefaultCgroupVersion() Version

func (*Client) GetCgroupForID

func (c *Client) GetCgroupForID(cgroupID ID) (*Cgroup, error)

func (*Client) GetCgroupsRootPath added in v1.22.0

func (c *Client) GetCgroupsRootPath() string

func (*Client) IsDefaultHierarchy added in v1.4.0

func (c *Client) IsDefaultHierarchy(hierarchyID uint32) bool

func (*Client) LoadCgroup added in v1.3.0

func (c *Client) LoadCgroup(id ID, path string)

type ContainerRuntimeID added in v1.3.0

type ContainerRuntimeID int

Represents the internal ID of a container runtime

const (
	UnknownRuntime ContainerRuntimeID = iota
	DockerRuntime
	ContainerdRuntime
	CrioRuntime
	PodmanRuntime
	GardenRuntime
)

func FromString added in v1.3.0

func FromString(str string) ContainerRuntimeID

func GetContainerIdFromCgroup added in v1.15.0

func GetContainerIdFromCgroup(cgroupPath string) (string, ContainerRuntimeID)

GetContainerIdFromCgroup extracts container id and its runtime from path. It returns the container id and the used runtime.

func (ContainerRuntimeID) String added in v1.3.0

func (runtime ContainerRuntimeID) String() string

type ID added in v1.3.0

type ID = uint64

type Stats added in v1.31.0

type Stats struct {
	CpuStats    *castaipb.CpuStats
	MemoryStats *castaipb.MemoryStats
	PidsStats   *castaipb.PidsStats
	IOStats     *castaipb.IOStats
}

type Version

type Version uint8

func (Version) String

func (v Version) String() string

Jump to

Keyboard shortcuts

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