Documentation
¶
Overview ¶
Package cgroups provides functions to parse cgroup information.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NestedKeyed ¶
NestedKeyed returns the nested keyed map of the cgroup values.
func ParseNestedKeyedValues ¶
func ParseNestedKeyedValues(r io.Reader) (NestedKeyed, error)
ParseNestedKeyedValues parses the cgroup values from the nested keyed map.
Nested keyed:
KEY0 SUB_KEY0=VAL00 SUB_KEY1=VAL01... KEY1 SUB_KEY0=VAL10 SUB_KEY1=VAL11... ...
type Node ¶
type Node struct { Children map[string]*Node CgroupEvents FlatMap CgroupFreeze Value CgroupProcs Values CgroupStat FlatMap CgroupThreads Values // Resolved externally into process names. CgroupProcsResolved []RawValue CPUIdle Value CPUMax Values CPUMaxBurst Value CPUPressure NestedKeyed CPUStat FlatMap CPUStatLocal FlatMap CPUWeight Value CPUWeightNice Value CPUSetCPUs RawValue CPUSetCPUsEffective RawValue CPUSetMems RawValue CPUSetMemsEffective RawValue IOBFQWeight FlatMap IOMax NestedKeyed IOPressure NestedKeyed IOStat NestedKeyed MemoryCurrent Value MemoryEvents FlatMap MemoryEventsLocal FlatMap MemoryHigh Value MemoryLow Value MemoryMax Value MemoryMin Value MemoryNUMAStat NestedKeyed MemoryOOMGroup Value MemoryPeak Value MemoryPressure NestedKeyed MemoryStat FlatMap MemorySwapCurrent Value MemorySwapEvents FlatMap MemorySwapHigh Value MemorySwapMax Value MemorySwapPeak Value PidsCurrent Value PidsEvents FlatMap PidsMax Value PidsPeak Value }
Node represents a cgroup node.
func (*Node) ResolveNames ¶
ResolveNames resolves the names of the node and its children.
func (*Node) SortedChildren ¶
SortedChildren returns the sorted children of the node.
type Tree ¶
type Tree struct {
Root *Node
}
Tree represents a cgroup tree.
func TreeFromTarGz ¶
TreeFromTarGz builds a crgroup tree from the tar.gz reader.
It is assumed to work with output of `talosctl cp /sys/fs/cgroup -`.
func (*Tree) ResolveNames ¶
ResolveNames resolves the names of the node and its children.
type Value ¶
Value represents a cgroup value.
Value might represent 'max' value.
func ParseValue ¶
ParseValue parses the cgroup value from the string.
func (Value) DivideBy ¶
DivideBy returns the value divided by another value in percentage.
a.DivideBy(b) = a / b * 100.
func (Value) HumanizeIBytes ¶
HumanizeIBytes returns the humanized bytes representation of the cgroup value.
func (Value) UsecToDuration ¶
UsecToDuration returns the duration representation of the cgroup value in microseconds.
type Values ¶
type Values []Value
Values represents a list of cgroup values.
func ParseNewlineSeparatedValues ¶
ParseNewlineSeparatedValues parses the cgroup values from the newline separated string.
New-line separated values (when only one value can be written at once)
VAL0\n VAL1\n ...