cgv1

package
v0.11.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockIOSubsystem

type BlockIOSubsystem 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.
	Total  TotalIOs `json:"total,omitempty" struct:"total"`   // Throttle limits for upper IO rates and metrics.
	Reads  TotalIOs `json:"reads,omitempty" struct:"reads"`   // Throttle limits for upper IO rates and metrics.
	Writes TotalIOs `json:"writes,omitempty" struct:"writes"` // Throttle limits for upper IO rates and metrics.

}

BlockIOSubsystem contains limits and metrics from the "blkio" subsystem. The blkio subsystem controls and monitors access to I/O on block devices by tasks in a cgroup.

https://www.kernel.org/doc/Documentation/cgroup-v1/blkio-controller.txt

func (*BlockIOSubsystem) Get

func (blkio *BlockIOSubsystem) Get(path string) error

Get reads metrics from the "blkio" subsystem. path is the filepath to the cgroup hierarchy to read.

type CFQDevice

type CFQDevice struct {
	DeviceID DeviceID `json:"device_id"` // ID of the device.

	// Proportional weight for the device. 0 means a per device weight is not set and
	// that the blkio.weight value is used.
	Weight uint64 `json:"weight"`

	TimeMs           uint64          `json:"time_ms"`          // Disk time allocated to cgroup per device in milliseconds.
	Sectors          uint64          `json:"sectors"`          // Number of sectors transferred to/from disk by the cgroup.
	Bytes            OperationValues `json:"io_service_bytes"` // Number of bytes transferred to/from the disk by the cgroup.
	IOs              OperationValues `json:"io_serviced"`      // Number of IO operations issued to the disk by the cgroup.
	ServiceTimeNanos OperationValues `json:"io_service_time"`  // Amount of time between request dispatch and request completion for the IOs done by this cgroup.
	WaitTimeNanos    OperationValues `json:"io_wait_time"`     // Amount of time the IOs for this cgroup spent waiting in the scheduler queues for service.
	Merges           OperationValues `json:"io_merged"`        // Total number of bios/requests merged into requests belonging to this cgroup.
}

CFQDevice contains CFQ limits and metrics associated with a single device.

type CFQScheduler

type CFQScheduler struct {
	Weight  uint64      `json:"weight"` // Default weight for all devices unless overridden. Allowed range of weights is from 10 to 1000.
	Devices []CFQDevice `json:"devices,omitempty"`
}

CFQScheduler contains limits and metrics for the proportional weight time based division of disk policy. It is implemented in CFQ. Hence this policy takes effect only on leaf nodes when CFQ is being used.

https://www.kernel.org/doc/Documentation/block/cfq-iosched.txt

type CFS

type CFS struct {
	// Period of time in microseconds for how regularly the cgroup's access to
	// CPU resources should be reallocated.
	PeriodMicros opt.Us `json:"period" struct:"period"`
	// Total amount of time in microseconds for which all tasks in the cgroup
	// can run during one period.
	QuotaMicros opt.Us `json:"quota" struct:"quota"`
	// Relative share of CPU time available to tasks the cgroup. The value is
	// an integer greater than or equal to 2.
	Shares uint64 `json:"shares"`
}

CFS contains the tunable parameters for the completely fair scheduler.

type CPUAccountingStats

type CPUAccountingStats struct {
	User   cgcommon.CPUUsage `json:"user" struct:"user"`
	System cgcommon.CPUUsage `json:"system" struct:"system"`
}

CPUAccountingStats contains the stats reported from the cpuacct subsystem.

type CPUAccountingSubsystem

type CPUAccountingSubsystem 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.
	Total       cgcommon.CPUUsage `json:"total_nanos"`
	UsagePerCPU map[string]uint64 `json:"percpu" struct:"percpu"`
	// CPU time statistics for tasks in this cgroup.
	Stats CPUAccountingStats `json:"stats,omitempty"`
}

CPUAccountingSubsystem contains metrics from the "cpuacct" subsystem. Note that percentage values are not taken from cgroup metrics, but derived via FillPercentages()

func (*CPUAccountingSubsystem) Get

func (cpuacct *CPUAccountingSubsystem) Get(path string) error

Get reads metrics from the "cpuacct" subsystem. path is the filepath to the cgroup hierarchy to read.

type CPUStats

type CPUStats struct {
	// Number of periods with throttling active.
	Periods   uint64         `json:"periods,omitempty"`
	Throttled ThrottledField `json:"throttled" struct:"throttled"`
}

CPUStats contains stats that indicate the extent to which this cgroup's CPU usage was throttled.

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.
	// Completely Fair Scheduler (CFS) settings.
	CFS CFS `json:"cfs,omitempty"`
	// Real-time (RT) Scheduler settings.
	RT RT `json:"rt,omitempty"`
	// CPU time statistics for tasks in this cgroup.
	Stats CPUStats `json:"stats,omitempty"`
}

CPUSubsystem contains metrics and limits from the "cpu" subsystem. This subsystem is used to guarantee a minimum number of cpu shares to the cgroup when the system is busy. This subsystem does not track CPU usage, for that information see the "cpuacct" subsystem.

func (*CPUSubsystem) Get

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

Get reads metrics from the "cpu" subsystem. path is the filepath to the cgroup hierarchy to read.

type DeviceID

type DeviceID struct {
	Major uint64
	Minor uint64
}

DeviceID identifies a Linux block device.

type MemSubsystemUsage

type MemSubsystemUsage struct {
	Bytes uint64    `json:"bytes" struct:"bytes"`
	Max   opt.Bytes `json:"max" struct:"max"`
}

MemSubsystemUsage groups fields used in memory.SUBSYSTEM.usage

type MemoryData

type MemoryData struct {
	Usage    MemSubsystemUsage `json:"usage" struct:"usage"`       // Usage in bytes.
	Limit    opt.Bytes         `json:"limit" struct:"limit"`       // Limit in bytes.
	Failures uint64            `json:"failures" struct:"failures"` // Number of times the memory limit has been reached.
}

MemoryData groups related memory usage metrics and limits.

type MemoryStat

type MemoryStat struct {
	// Page cache, including tmpfs (shmem), in bytes.
	Cache opt.Bytes `json:"cache" struct:"cache"`
	// Anonymous and swap cache, not including tmpfs (shmem), in bytes.
	RSS opt.Bytes `json:"rss" struct:"rss"`
	// Anonymous transparent hugepages in bytes.
	RSSHuge opt.Bytes `json:"rss_huge" struct:"rss_huge"`
	// Size of memory-mapped mapped files, including tmpfs (shmem), in bytes.
	MappedFile opt.Bytes `json:"mapped_file" struct:"mapped_file"`
	// Number of pages paged into memory.
	PagesIn uint64 `json:"pages_in" struct:"pages_in"`
	// Number of pages paged out of memory.
	PagesOut uint64 `json:"pages_out" struct:"pages_out"`
	// Number of times a task in the cgroup triggered a page fault.
	PageFaults uint64 `json:"page_faults" struct:"page_faults"`
	// Number of times a task in the cgroup triggered a major page fault.
	MajorPageFaults uint64 `json:"major_page_faults" struct:"major_page_faults"`
	// Swap usage in bytes.
	Swap opt.Bytes `json:"swap"`
	// 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"`
	// Anonymous and swap cache on inactive LRU list, including tmpfs (shmem), in bytes.
	InactiveAnon opt.Bytes `json:"inactive_anon" struct:"inactive_anon"`
	// File-backed memory on active LRU list, in bytes.
	ActiveFile opt.Bytes `json:"active_file" struct:"active_file"`
	// File-backed memory on inactive LRU list, in bytes.
	InactiveFile opt.Bytes `json:"inactive_file" struct:"inactive_file"`
	// Memory that cannot be reclaimed, in bytes.
	Unevictable opt.Bytes `json:"unevictable" struct:"unevictable"`
	// Memory limit for the hierarchy that contains the memory cgroup, in bytes.
	HierarchicalMemoryLimit opt.Bytes `json:"hierarchical_memory_limit" struct:"hierarchical_memory_limit"`
	// Memory plus swap limit for the hierarchy that contains the memory cgroup, in bytes.
	HierarchicalMemswLimit opt.Bytes `json:"hierarchical_memsw_limit" struct:"hierarchical_memsw_limit"`
}

MemoryStat contains various memory statistics and accounting information associated with a cgroup.

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.
	Kernel    MemoryData `json:"kmem" struct:"kmem"`         // Kernel memory used by tasks in this cgroup.
	KernelTCP MemoryData `json:"kmem_tcp" struct:"kmem_tcp"` // Kernel TCP buffer memory used 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 reads metrics from the "memory" subsystem. path is the filepath to the cgroup hierarchy to read.

type OperationValues

type OperationValues struct {
	Read  uint64 `json:"read"`
	Write uint64 `json:"write"`
	Async uint64 `json:"async"`
	Sync  uint64 `json:"sync"`
}

OperationValues contains the I/O limits or metrics associated with read, write, sync, and async operations.

type RT

type RT struct {
	// Period of time in microseconds for how regularly the cgroup's access to
	// CPU resources should be reallocated.
	Period opt.Us `json:"period" struct:"period"`
	// Period of time in microseconds for the longest continuous period in which
	// the tasks in the cgroup have access to CPU resources.
	Runtime opt.Us `json:"runtime" struct:"runtime"`
}

RT contains the tunable parameters for the real-time scheduler.

type ThrottleDevice

type ThrottleDevice struct {
	DeviceID DeviceID `json:"device_id"` // ID of the device.

	ReadLimitBPS   uint64 `json:"read_bps_device"`   // Read limit in bytes per second (BPS). Zero means no limit.
	WriteLimitBPS  uint64 `json:"write_bps_device"`  // Write limit in bytes per second (BPS). Zero mean no limit.
	ReadLimitIOPS  uint64 `json:"read_iops_device"`  // Read limit in IOPS. Zero means no limit.
	WriteLimitIOPS uint64 `json:"write_iops_device"` // Write limit in IOPS. Zero means no limit.

	Bytes OperationValues `json:"io_service_bytes"` // Number of bytes transferred to/from the disk by the cgroup.
	IOs   OperationValues `json:"io_serviced"`      // Number of IO operations issued to the disk by the cgroup.
}

ThrottleDevice contains throttle limits and metrics associated with a single device.

type ThrottledField

type ThrottledField struct {
	Us      uint64 `json:"us" struct:"us"`
	Periods uint64 `json:"periods" struct:"periods"`
}

ThrottledField contains the `throttled` information for the CPU stats

type TotalIOs

type TotalIOs struct {
	Bytes uint64 `json:"bytes,omitempty" struct:"bytes,omitempty"`
	Ios   uint64 `json:"ios,omitempty" struct:"ios,omitempty"`
}

TotalIOs wraps the totals for blkio

Jump to

Keyboard shortcuts

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