cgv2

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUStats

type CPUStats struct {
	//The following three metrics are only available when the controller is enabled.
	Throttled ThrottledField    `json:"throttled,omitempty" struct:"throttled,omitempty"`
	Periods   opt.Uint          `json:"periods,omitempty" struct:"periods,omitempty"`
	Usage     cgcommon.CPUUsage `json:"usage" struct:"usage"`
	User      cgcommon.CPUUsage `json:"user" struct:"user"`
	System    cgcommon.CPUUsage `json:"system" struct:"system"`
}

CPUStats carries the information from the cpu.stat cgroup file

type CPUSubsystem

type CPUSubsystem struct {
	ID   string `json:"id,omitempty"`   // ID of the cgroup.
	Path string `json:"path,omitempty"` // Path to the cgroup relative to the cgroup subsystem's mountpoint.
	// Shows pressure stall information for CPU.
	Pressure map[string]cgcommon.Pressure `json:"pressure,omitempty" struct:"pressure,omitempty"`
	// Stats shows overall counters for the CPU controller
	Stats CPUStats
}

CPUSubsystem contains metrics and limits from the "cpu" subsystem. in cgroupsV2, this merges both the 'cpu' and 'cpuacct' controllers.

func (*CPUSubsystem) Get

func (cpu *CPUSubsystem) Get(path string) error

Get fetches memory subsystem metrics for V2 cgroups

type Events

type Events struct {
	Low     opt.Uint `json:"low,omitempty" struct:"low,omitempty"`
	High    uint64   `json:"high" struct:"high"`
	Max     uint64   `json:"max" struct:"max"`
	OOM     opt.Uint `json:"oom,omitempty" struct:"oom,omitempty"`
	OOMKill opt.Uint `json:"oom_kill,omitempty" struct:"oom_kill,omitempty"`
	Fail    opt.Uint `json:"fail,omitempty" struct:"fail,omitempty"`
}

Events contains the data from *.events in the memory controller

type IOMetric

type IOMetric struct {
	Bytes uint64 `json:"bytes" struct:"bytes"`
	IOs   uint64 `json:"ios" struct:"ios"`
}

IOMetric groups together the common IO sub-metrics by bytes and IOOps count

type IOStat

type IOStat struct {
	Read      IOMetric `json:"read" struct:"read"`
	Write     IOMetric `json:"write" struct:"write"`
	Discarded IOMetric `json:"discarded" struct:"discarded"`
}

IOStat carries io.Stat data for the controllers This data is broken down per-device, based on the maj-minor device ID

type IOSubsystem

type IOSubsystem struct {
	ID   string `json:"id,omitempty"`   // ID of the cgroup.
	Path string `json:"path,omitempty"` // Path to the cgroup relative to the cgroup subsystem's mountpoint.

	Stats    map[string]IOStat            `json:"stats" struct:"stats"`
	Pressure map[string]cgcommon.Pressure `json:"pressure" struct:"pressure"`
}

IOSubsystem is the replacement for the bulkio controller in cgroupsV1

func (*IOSubsystem) Get

func (io *IOSubsystem) Get(path string, resolveDevIDs bool) error

Get fetches metrics for the IO subsystem resolveDevIDs determines if Get will try to resolve the major-minor ID pairs reported by io.stat are resolved to a device name

type MemoryData

type MemoryData struct {
	Events Events       `json:"events" struct:"events"`
	Usage  opt.Bytes    `json:"usage" struct:"usage"`
	Low    opt.Bytes    `json:"low" struct:"low"`
	High   opt.BytesOpt `json:"high,omitempty" struct:"high,omitempty"`
	Max    opt.BytesOpt `json:"max,omitempty" struct:"max,omitempty"`
}

MemoryData contains basic metrics for the V2 controller

type MemoryStat

type MemoryStat struct {
	//Amount of memory used in anonymous mappings
	Anon opt.Bytes `json:"anon" struct:"anon" orig:"anon"`
	//Amount of memory used to cache filesystem data, including tmpfs and shared memory.
	File opt.Bytes `json:"file" struct:"file" orig:"file"`
	// Amount of memory allocated to kernel stacks.
	KernelStack opt.Bytes `json:"kernel_stack" struct:"kernel_stack" orig:"kernel_stack"`
	//Amount of memory allocated for page tables.
	Pagetables opt.Bytes `json:"page_tables" struct:"page_tables" orig:"pagetables"`
	// Amount of memory used for storing per-cpu kernel data structures.
	PerCPU opt.Bytes `json:"per_cpu" struct:"per_cpu" orig:"percpu"`
	// Amount of memory used in network transmission buffers
	Sock opt.Bytes `json:"sock" struct:"sock" orig:"sock"`
	// Amount of cached filesystem data that is swap-backed, such as tmpfs, shm segments, shared anonymous mmap()s
	Shmem opt.Bytes `json:"shmem" struct:"shmem" orig:"shmem"`
	// Amount of cached filesystem data mapped with mmap()
	FileMapped opt.Bytes `json:"file_mapped" struct:"file_mapped" orig:"file_mapped"`
	//Amount of cached filesystem data that was modified but not yet written back to disk
	FileDirty opt.Bytes `json:"file_dirty" struct:"file_dirty" orig:"file_dirty"`
	// Amount of cached filesystem data that was modified and is currently being written back to disk
	FileWriteback opt.Bytes `json:"file_writeback" struct:"file_writeback" orig:"file_writeback"`
	// Amount of swap cached in memory. The swapcache is accounted against both memory and swap usage.
	SwapCached opt.Bytes `json:"swap_cached" struct:"swap_cached" orig:"swapcached"`
	// Amount of memory used in anonymous mappings backed by transparent hugepages
	AnonTHP opt.Bytes `json:"anon_thp" struct:"anon_thp" orig:"anon_thp"`
	// Amount of cached filesystem data backed by transparent hugepages
	FileTHP opt.Bytes `json:"file_thp" struct:"file_thp" orig:"file_thp"`
	// Amount of shm, tmpfs, shared anonymous mmap()s backed by transparent hugepages
	ShmemTHP opt.Bytes `json:"shmem_thp" struct:"shmem_thp" orig:"shmem_thp"`
	// Anonymous and swap cache on inactive LRU list, including tmpfs (shmem), in bytes.
	InactiveAnon opt.Bytes `json:"inactive_anon" struct:"inactive_anon" orig:"inactive_anon"`
	// Anonymous and swap cache on active least-recently-used (LRU) list, including tmpfs (shmem), in bytes.
	ActiveAnon opt.Bytes `json:"active_anon" struct:"active_anon" orig:"active_anon"`
	// File-backed memory on inactive LRU list, in bytes.
	InactiveFile opt.Bytes `json:"inactive_file" struct:"inactive_file" orig:"inactive_file"`
	// File-backed memory on active LRU list, in bytes.
	ActiveFile opt.Bytes `json:"active_file" struct:"active_file" orig:"active_file"`
	// Memory that cannot be reclaimed, in bytes.
	Unevictable opt.Bytes `json:"unevictable" struct:"unevictable" orig:"unevictable"`
	// Part of "slab" that might be reclaimed, such as dentries and inodes.
	SlabReclaimable opt.Bytes `json:"slab_reclaimable" struct:"slab_reclaimable" orig:"slab_reclaimable"`
	// Part of "slab" that cannot be reclaimed on memory pressure.
	SlabUnreclaimable opt.Bytes `json:"slab_unreclaimable" struct:"slab_unreclaimable" orig:"slab_unreclaimable"`
	// Amount of memory used for storing in-kernel data structures.
	Slab opt.Bytes `json:"slab" struct:"slab" orig:"slab"`
	// Number of refaults of previously evicted anonymous pages.
	WorkingSetRefaultAnon uint64 `json:"workingset_refault_anon" struct:"workingset_refault_anon" orig:"workingset_refault_anon"`
	// Number of refaults of previously evicted file pages.
	WorkingSetRefaultFile uint64 `json:"workingset_refault_file" struct:"workingset_refault_file" orig:"workingset_refault_file"`
	// Number of refaulted anonymous pages that were immediately activated.
	WorkingSetActivateAnon uint64 `json:"workingset_activate_anon" struct:"workingset_activate_anon" orig:"workingset_activate_anon"`
	// Number of refaulted file pages that were immediately activated.
	WorkingSetActivateFile uint64 `json:"workingset_activate_file" struct:"workingset_activate_file" orig:"workingset_activate_file"`
	// Number of restored anonymous pages which have been detected as an active workingset before they got reclaimed.
	WorkingSetRestoreAnon uint64 `json:"workingset_restore_anon" struct:"workingset_restore_anon" orig:"workingset_restore_anon"`
	// Number of restored file pages which have been detected as an active workingset before they got reclaimed.
	WorkingSetRestoreFile uint64 `json:"workingset_restore_file" struct:"workingset_restore_file" orig:"workingset_restore_file"`
	// Number of times a shadow node has been reclaimed
	WorkingSetNodeReclaim uint64 `json:"workingset_node_reclaim" struct:"workingset_node_reclaim" orig:"workingset_nodereclaim"`
	//Total number of page faults incurred
	PageFaults uint64 `json:"page_faults" struct:"page_faults" orig:"pgfault"`
	// Number of times a task in the cgroup triggered a major page fault.
	MajorPageFaults uint64 `json:"major_page_faults" struct:"major_page_faults" orig:"pgmajfault"`
	// Amount of scanned pages (in an active LRU list)
	PageRefill uint64 `json:"page_refill" struct:"page_refill" orig:"pgrefill"`
	// Amount of scanned pages (in an inactive LRU list)
	PageScan uint64 `json:"page_scan" struct:"page_scan" orig:"pgscan"`
	// Amount of reclaimed pages
	PageSteal uint64 `json:"page_steal" struct:"page_steal" orig:"pgsteal"`
	//Amount of pages moved to the active LRU list
	PageActivate uint64 `json:"page_activate" struct:"page_activate" orig:"pgactivate"`
	// Amount of pages moved to the inactive LRU list
	PageDeactivate uint64 `json:"page_deactivate" struct:"page_deactivate" orig:"pgdeactivate"`
	// Amount of pages postponed to be freed under memory pressure
	PageLazyFree uint64 `json:"page_lazy_free" struct:"page_lazy_free" orig:"pglazyfree"`
	// Amount of reclaimed lazyfree pages
	PageLazyFreed uint64 `json:"page_lazy_freed" struct:"page_lazy_freed" orig:"pglazyfreed"`
	// Number of transparent hugepages which were allocated to satisfy a page fault.
	THPFaultAlloc uint64 `json:"thp_fault_alloc" struct:"thp_fault_alloc" orig:"thp_fault_alloc"`
	// Number of transparent hugepages which were allocated to allow collapsing an existing range of pages.
	THPCollapseAlloc uint64 `json:"htp_collapse_alloc" struct:"htp_collapse_alloc" orig:"thp_collapse_alloc"`
}

MemoryStat holds detailed stats for the memory controller

type MemorySubsystem

type MemorySubsystem struct {
	ID   string `json:"id,omitempty"`   // ID of the cgroup.
	Path string `json:"path,omitempty"` // Path to the cgroup relative to the cgroup subsystem's mountpoint.

	Mem     MemoryData `json:"mem" struct:"mem"`     // Memory usage by tasks in this cgroup.
	MemSwap MemoryData `json:"memsw" struct:"memsw"` // Memory plus swap usage by tasks in this cgroup.
	Stats   MemoryStat `json:"stats" struct:"stats"` // A wide range of memory statistics.
}

MemorySubsystem contains the metrics and limits from the "memory" subsystem.

func (*MemorySubsystem) Get

func (mem *MemorySubsystem) Get(path string) error

Get fetches memory subsystem metrics for V2 cgroups

type ThrottledField

type ThrottledField struct {
	Us      opt.Uint `json:"us,omitempty" struct:"us,omitempty"`
	Periods opt.Uint `json:"periods,omitempty" struct:"periods,omitempty"`
}

ThrottledField contains the `throttled` information for the CPU stats

func (ThrottledField) IsZero

func (t ThrottledField) IsZero() bool

IsZero implements the IsZero interface for ThrottledField

Jump to

Keyboard shortcuts

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