cgroup

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	V1 = iota
	V2
)

Variables

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

Functions

func Init

func Init() error

Types

type CPUStat

type CPUStat struct {
	UsageSeconds         float64
	ThrottledTimeSeconds float64
	LimitCores           float64
}

type Cgroup

type Cgroup struct {
	Id            uint64
	Version       Version
	ContainerType ContainerType
	ContainerID   string
	Path          string
	// contains filtered or unexported fields
}

func NewFromProcessCgroupFile

func NewFromProcessCgroupFile(filePath string) (*Cgroup, error)

func (Cgroup) CpuStat

func (cg Cgroup) CpuStat() (*CPUStat, error)

func (*Cgroup) CreatedAt

func (cg *Cgroup) CreatedAt() time.Time

func (*Cgroup) IOStat

func (cg *Cgroup) IOStat() (map[string]IOStat, error)

func (*Cgroup) MemoryStat

func (cg *Cgroup) MemoryStat() (*MemoryStat, error)

type Client

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

func NewClient

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

func (*Client) DefaultCgroupVersion

func (c *Client) DefaultCgroupVersion() Version

func (*Client) GetCgroupForContainer

func (c *Client) GetCgroupForContainer(containerID string) (*Cgroup, error)

func (*Client) GetCgroupForID

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

type ContainerType

type ContainerType uint8
const (
	ContainerTypeUnknown ContainerType = iota
	ContainerTypeStandaloneProcess
	ContainerTypeDocker
	ContainerTypeCrio
	ContainerTypeContainerd
	ContainerTypeLxc
	ContainerTypeSystemdService
	ContainerTypeSandbox
)

func (ContainerType) String

func (t ContainerType) String() string

type IOStat

type IOStat struct {
	ReadOps      uint64
	WriteOps     uint64
	ReadBytes    uint64
	WrittenBytes uint64
}

type MemoryStat

type MemoryStat struct {
	RSS   uint64
	Cache uint64
	Limit uint64
}

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