Documentation ¶
Index ¶
- Constants
- func GetBECPUSetPathsByMaxDepth(relativeDepth int) ([]string, error)
- func GetBECPUSetPathsByTargetDepth(relativeDepth int) ([]string, error)
- func GetBECgroupCurCPUSet() ([]int32, error)
- func GetCPUStatUsageTicks() (uint64, error)
- func GetCgroupMemUsageWithHotPageCache(cgroupReader resourceexecutor.CgroupReader, parentDir string, ...) (uint64, error)
- func GetCgroupPathsByTargetDepth(resourceType system.ResourceType, cgroupParent string, relativeDepth int) ([]string, error)
- func GetCgroupRootBlkIOAbsoluteDir() string
- func GetContainerBaseCFSQuota(container *corev1.Container) int64
- func GetContainerCgroupCPUProcsPath(podParentDir string, c *corev1.ContainerStatus) (string, error)
- func GetContainerCgroupParentDir(podParentDir string, c *corev1.ContainerStatus) (string, error)
- func GetContainerCgroupParentDirByID(podParentDir string, containerID string) (string, error)
- func GetContainerCgroupPath(podParentDir string, c *corev1.ContainerStatus, ...) (string, error)
- func GetContainerCgroupPerfPath(podParentDir string, c *corev1.ContainerStatus) (string, error)
- func GetContainerCyclesAndInstructions(collector perf.Collector) (float64, float64, error)
- func GetContainerPerfCollector(podCgroupDir string, c *corev1.ContainerStatus, number int32) (*perf.PerfCollector, error)
- func GetContainerPerfGroupCollector(podCgroupDir string, c *corev1.ContainerStatus, number int32, events []string) (*perfgroup.PerfGroupCollector, error)
- func GetHostAppCgroupRelativePath(hostAppSpec *slov1alpha1.HostApplicationSpec) string
- func GetHugePagesInfo(nodeDir string) (map[uint64]*HugePagesInfo, error)
- func GetKubeQoSByCgroupParent(cgroupDir string) corev1.PodQOSClass
- func GetNodeHugePagesInfo() (map[int32]map[uint64]*HugePagesInfo, error)
- func GetNodeMemUsageWithHotPageCache(coldPageUsageBytes uint64) (uint64, error)
- func GetPIDsInContainer(podParentDir string, c *corev1.ContainerStatus) ([]uint32, error)
- func GetPIDsInPod(podParentDir string, cs []corev1.ContainerStatus) ([]uint32, error)
- func GetPodCgroupBlkIOAbsoluteDir(qosClass corev1.PodQOSClass) string
- func GetPodCgroupBlkIOAbsolutePath(podParentDir string) string
- func GetPodCgroupParentDir(pod *corev1.Pod) string
- func GetPodQoSRelativePath(qosClass corev1.PodQOSClass) string
- func GetPodSandboxContainerID(pod *corev1.Pod) (string, error)
- func GetRootCgroupCPUSetDir(qosClass corev1.PodQOSClass) string
- func IsValidContainerCgroupDir(containerParentDir string) bool
- func ParseContainerID(basename string) (string, error)
- func ParsePodID(basename string) (string, error)
- type CPUTotalInfo
- type DeviceType
- type Devices
- type GPUDeviceInfo
- type GPUDevices
- type HugePagesInfo
- type LocalCPUInfo
- type LocalStorageInfo
- type MemInfo
- type NUMAInfo
- type NodeNUMAInfo
- type ProcessorInfo
Constants ¶
const ( Hugepage1Gkbyte = 1048576 Hugepage2Mkbyte = 2048 )
const ( PodCgroupPathRelativeDepth = 1 ContainerCgroupPathRelativeDepth = 2 )
Variables ¶
This section is empty.
Functions ¶
func GetBECPUSetPathsByMaxDepth ¶ added in v1.1.1
GetBECPUSetPathsByMaxDepth gets all the be cpuset groups' paths recursively from upper to lower
func GetBECPUSetPathsByTargetDepth ¶ added in v1.1.1
GetBECPUSetPathsByTargetDepth only gets the be containers' cpuset groups' paths
func GetBECgroupCurCPUSet ¶ added in v1.1.1
GetBECgroupCurCPUSet gets the current cpuset of besteffort podQoS' cgroup.
func GetCPUStatUsageTicks ¶
GetCPUStatUsageTicks returns the node's CPU usage ticks
func GetCgroupMemUsageWithHotPageCache ¶ added in v1.4.0
func GetCgroupMemUsageWithHotPageCache(cgroupReader resourceexecutor.CgroupReader, parentDir string, coldPageUsageBytes uint64) (uint64, error)
func GetCgroupPathsByTargetDepth ¶ added in v1.4.1
func GetCgroupRootBlkIOAbsoluteDir ¶ added in v1.3.0
func GetCgroupRootBlkIOAbsoluteDir() string
GetCgroupRootBlkIOAbsoluteDir gets the root blkio directory @output /sys/fs/cgroup/blkio
func GetContainerCgroupCPUProcsPath ¶ added in v1.1.0
func GetContainerCgroupCPUProcsPath(podParentDir string, c *corev1.ContainerStatus) (string, error)
@parentDir kubepods-burstable.slice/kubepods-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice/ @return /sys/fs/cgroup/cpu/kubepods.slice/kubepods-burstable.slice/kubepods-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice/cgroup.procs
func GetContainerCgroupParentDir ¶ added in v1.2.0
func GetContainerCgroupParentDir(podParentDir string, c *corev1.ContainerStatus) (string, error)
GetContainerCgroupParentDir gets the full container cgroup parent with the pod parent dir and the containerStatus. @parentDir kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice/ @return kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice/****.scope
func GetContainerCgroupParentDirByID ¶ added in v1.2.0
GetContainerCgroupParentDirByID gets the full container cgroup parent dir with the podParentDir and the container ID. @parentDir kubepods.slice/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice/ @return kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice/****.scope
func GetContainerCgroupPath ¶ added in v1.2.0
func GetContainerCgroupPath(podParentDir string, c *corev1.ContainerStatus, resourceType system.ResourceType) (string, error)
GetContainerCgroupPath gets the file path of the given container's cgroup. @parentDir kubepods-burstable.slice/kubepods-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice/ @return /sys/fs/cgroup/cpu/kubepods.slice/kubepods-burstable.slice/kubepods-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice/cgroup.procs
func GetContainerCgroupPerfPath ¶ added in v1.1.0
func GetContainerCgroupPerfPath(podParentDir string, c *corev1.ContainerStatus) (string, error)
func GetContainerCyclesAndInstructions ¶ added in v1.1.0
func GetContainerPerfCollector ¶ added in v1.1.0
func GetContainerPerfCollector(podCgroupDir string, c *corev1.ContainerStatus, number int32) (*perf.PerfCollector, error)
func GetContainerPerfGroupCollector ¶ added in v1.4.0
func GetContainerPerfGroupCollector(podCgroupDir string, c *corev1.ContainerStatus, number int32, events []string) (*perfgroup.PerfGroupCollector, error)
func GetHostAppCgroupRelativePath ¶ added in v1.4.0
func GetHostAppCgroupRelativePath(hostAppSpec *slov1alpha1.HostApplicationSpec) string
func GetHugePagesInfo ¶ added in v1.4.0
func GetHugePagesInfo(nodeDir string) (map[uint64]*HugePagesInfo, error)
func GetKubeQoSByCgroupParent ¶ added in v1.1.0
func GetKubeQoSByCgroupParent(cgroupDir string) corev1.PodQOSClass
func GetNodeHugePagesInfo ¶ added in v1.4.0
func GetNodeHugePagesInfo() (map[int32]map[uint64]*HugePagesInfo, error)
GetNodeHugePagesInfo gets the node NUMA hugepage information with pre-configured sysfs path.
func GetNodeMemUsageWithHotPageCache ¶ added in v1.4.0
func GetPIDsInContainer ¶ added in v1.1.0
func GetPIDsInContainer(podParentDir string, c *corev1.ContainerStatus) ([]uint32, error)
func GetPIDsInPod ¶ added in v1.1.0
func GetPIDsInPod(podParentDir string, cs []corev1.ContainerStatus) ([]uint32, error)
func GetPodCgroupBlkIOAbsoluteDir ¶ added in v1.3.0
func GetPodCgroupBlkIOAbsoluteDir(qosClass corev1.PodQOSClass) string
GetPodCgroupBlkIOAbsoluteDir gets the blkio parent directory of the specified podQos' root cgroup @output /sys/fs/cgroup/blkio/kubepods.slice/kubepods-besteffort.slice
func GetPodCgroupBlkIOAbsolutePath ¶ added in v1.3.0
@return like kubepods-burstable.slice/kubepods-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice/ /sys/fs/cgroup/blkio/kubepods.slice/kubepods-burstable.slice/kubepods-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice
func GetPodCgroupParentDir ¶ added in v1.2.0
GetPodCgroupParentDir gets the full pod cgroup parent with the pod info. @podKubeRelativeDir kubepods-burstable.slice/kubepods-burstable-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice/ @return kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice/
func GetPodQoSRelativePath ¶
func GetPodQoSRelativePath(qosClass corev1.PodQOSClass) string
GetPodQoSRelativePath gets the relative parent directory of a pod's qos class. @qosClass corev1.PodQOSBurstable @return kubepods.slice/kubepods-burstable.slice/
func GetPodSandboxContainerID ¶ added in v1.3.0
GetPodSandboxContainerID lists all dirs of pod cgroup(cpuset), exclude containers' dir, get sandbox hash id from the remaining dir. e.g. return "containerd://91cf0413ee0e6745335e9043b261a829ce07d28a5a66b5ec39b06811ef75a1ff"
func GetRootCgroupCPUSetDir ¶
func GetRootCgroupCPUSetDir(qosClass corev1.PodQOSClass) string
GetRootCgroupCPUSetDir gets the cpuset parent directory of the specified podQos' root cgroup @output /sys/fs/cgroup/cpuset/kubepods.slice/kubepods-besteffort.slice
func IsValidContainerCgroupDir ¶ added in v1.4.0
func ParseContainerID ¶
ParseContainerID parse container ID from the container base path. e.g. 7712555c_ce62_454a_9e18_9ff0217b8941 from docker-7712555c_ce62_454a_9e18_9ff0217b8941.scope
func ParsePodID ¶
ParsePodID parse pod ID from the pod base path. e.g. 7712555c_ce62_454a_9e18_9ff0217b8941 from kubepods-pod7712555c_ce62_454a_9e18_9ff0217b8941.slice
Types ¶
type CPUTotalInfo ¶
type CPUTotalInfo struct { NumberCPUs int32 `json:"numberCPUs"` CoreToCPU map[int32][]ProcessorInfo `json:"coreToCPU"` NodeToCPU map[int32][]ProcessorInfo `json:"nodeToCPU"` SocketToCPU map[int32][]ProcessorInfo `json:"socketToCPU"` L3ToCPU map[int32][]ProcessorInfo `json:"l3ToCPU"` }
CPUTotalInfo describes the total number infos of the local cpu, e.g. the number of cores, the number of numa nodes
type Devices ¶ added in v1.3.0
type Devices interface {
Type() DeviceType
}
type GPUDeviceInfo ¶ added in v1.3.0
type GPUDeviceInfo struct { // UUID represents the UUID of device UUID string `json:"id,omitempty"` // Minor represents the Minor number of Devices, starting from 0 Minor int32 `json:"minor,omitempty"` MemoryTotal uint64 `json:"memory-total,omitempty"` NodeID int32 `json:"nodeID"` PCIE string `json:"pcie,omitempty"` BusID string `json:"busID,omitempty"` }
type GPUDevices ¶ added in v1.3.0
type GPUDevices []GPUDeviceInfo
func (GPUDevices) Type ¶ added in v1.3.0
func (g GPUDevices) Type() DeviceType
type HugePagesInfo ¶ added in v1.4.0
type HugePagesInfo struct { NumPages uint64 `json:"numPages,omitempty"` PageSize uint64 `json:"pageSize,omitempty"` }
func (*HugePagesInfo) MemTotalBytes ¶ added in v1.4.0
func (i *HugePagesInfo) MemTotalBytes() uint64
type LocalCPUInfo ¶
type LocalCPUInfo struct { // BasicInfo describe the cpu features and their status BasicInfo extension.CPUBasicInfo `json:"basicInfo,omitempty"` // ProcessorInfos contains topology information of all available CPUs ProcessorInfos []ProcessorInfo `json:"processorInfos,omitempty"` // TotalInfo stores the numbers of cpu processors, cores, sockets and nodes TotalInfo CPUTotalInfo `json:"totalInfo,omitempty"` }
LocalCPUInfo contains the cpu information collected from the node
func GetLocalCPUInfo ¶
func GetLocalCPUInfo() (*LocalCPUInfo, error)
GetLocalCPUInfo returns the local cpu info for cpuset allocation, NUMA-aware scheduling
type LocalStorageInfo ¶ added in v1.3.0
type LocalStorageInfo struct { // mapper of disk and disk number, such as "/dev/vda":"253:0" DiskNumberMap map[string]string // mapper of disk number and disk, such as "253:0":"/dev/vda" NumberDiskMap map[string]string // mapper of partition and its disk, such as "/dev/vdb3":"/dev/vdb" PartitionDiskMap map[string]string // mapper of volumegroup and its disk, such as "yoda-pool0":"/dev/vdb" VGDiskMap map[string]string // mapper of logicalvolume and its volumegroup, such as "/dev/mapper/yoda--pool0-yoda--2c52d97f--eab6--4ac5--ba8b--242f399470e1":"yoda-pool0" LVMapperVGMap map[string]string // mapper of mountpoint and its disk, such as "/var/lib/kubelet/pods/d806ee8d-fe28-4995-a836-d2356d44ec5f/volumes/kubernetes.io~csi/yoda-2c52d97f-eab6-4ac5-ba8b-242f399470e1/mount":"/dev/mapper/yoda--pool0-yoda--2c52d97f--eab6--4ac5--ba8b--242f399470e1" MPDiskMap map[string]string }
func GetLocalStorageInfo ¶ added in v1.3.0
func GetLocalStorageInfo() (*LocalStorageInfo, error)
type MemInfo ¶
type MemInfo struct { MemTotal uint64 `json:"mem_total"` MemFree uint64 `json:"mem_free"` MemAvailable uint64 `json:"mem_available"` Buffers uint64 `json:"buffers"` Cached uint64 `json:"cached"` SwapCached uint64 `json:"swap_cached"` Active uint64 `json:"active"` Inactive uint64 `json:"inactive"` ActiveAnon uint64 `json:"active_anon" field:"Active(anon)"` InactiveAnon uint64 `json:"inactive_anon" field:"Inactive(anon)"` ActiveFile uint64 `json:"active_file" field:"Active(file)"` InactiveFile uint64 `json:"inactive_file" field:"Inactive(file)"` Unevictable uint64 `json:"unevictable"` Mlocked uint64 `json:"mlocked"` SwapTotal uint64 `json:"swap_total"` SwapFree uint64 `json:"swap_free"` Dirty uint64 `json:"dirty"` Writeback uint64 `json:"write_back"` AnonPages uint64 `json:"anon_pages"` Mapped uint64 `json:"mapped"` Shmem uint64 `json:"shmem"` Slab uint64 `json:"slab"` SReclaimable uint64 `json:"s_reclaimable"` SUnreclaim uint64 `json:"s_unclaim"` KernelStack uint64 `json:"kernel_stack"` PageTables uint64 `json:"page_tables"` NFS_Unstable uint64 `json:"nfs_unstable"` Bounce uint64 `json:"bounce"` WritebackTmp uint64 `json:"writeback_tmp"` CommitLimit uint64 `json:"commit_limit"` Committed_AS uint64 `json:"committed_as"` VmallocTotal uint64 `json:"vmalloc_total"` VmallocUsed uint64 `json:"vmalloc_used"` VmallocChunk uint64 `json:"vmalloc_chunk"` HardwareCorrupted uint64 `json:"hardware_corrupted"` AnonHugePages uint64 `json:"anon_huge_pages"` HugePages_Total uint64 `json:"huge_pages_total"` HugePages_Free uint64 `json:"huge_pages_free"` HugePages_Rsvd uint64 `json:"huge_pages_rsvd"` HugePages_Surp uint64 `json:"huge_pages_surp"` Hugepagesize uint64 `json:"hugepagesize"` DirectMap4k uint64 `json:"direct_map_4k"` DirectMap2M uint64 `json:"direct_map_2M"` DirectMap1G uint64 `json:"direct_map_1G"` }
MemInfo is the content of system /proc/meminfo. NOTE: the unit of each field is KiB.
func GetMemInfo ¶ added in v1.3.0
func (*MemInfo) MemTotalBytes ¶ added in v1.3.0
MemTotalBytes returns the mem info's total bytes.
func (*MemInfo) MemUsageBytes ¶ added in v1.3.0
MemUsageBytes returns the mem info's usage bytes.
func (*MemInfo) MemUsageWithPageCache ¶ added in v1.4.0
MemWithPageCacheUsageBytes returns the usage of mem with page cache bytes.
type NUMAInfo ¶ added in v1.3.0
type NUMAInfo struct { NUMANodeID int32 `json:"numaNodeID,omitempty"` MemInfo *MemInfo `json:"memInfo,omitempty"` HugePages map[uint64]*HugePagesInfo `json:"hugePages,omitempty"` }
type NodeNUMAInfo ¶ added in v1.3.0
type NodeNUMAInfo struct { NUMAInfos []NUMAInfo `json:"numaInfos,omitempty"` MemInfoMap map[int32]*MemInfo `json:"memInfoMap,omitempty"` // NUMANodeID -> MemInfo HugePagesMap map[int32]map[uint64]*HugePagesInfo `json:"hugePagesMap,omitempty"` }
NodeNUMAInfo represents the node NUMA information. Currently, it just contains the meminfo for each NUMA node.
func GetAndMergeHugepageToNumaInfo ¶ added in v1.4.0
func GetAndMergeHugepageToNumaInfo(numaInfo *NodeNUMAInfo) *NodeNUMAInfo
func GetNodeNUMAInfo ¶ added in v1.3.0
func GetNodeNUMAInfo() (*NodeNUMAInfo, error)
GetNodeNUMAInfo gets the node NUMA information with the pre-configured sysfs path.
type ProcessorInfo ¶
type ProcessorInfo struct { // logic CPU/ processor ID CPUID int32 `json:"cpu"` // physical CPU core ID CoreID int32 `json:"core"` // cpu socket ID SocketID int32 `json:"socket"` // numa node ID NodeID int32 `json:"node"` // L1 L2 cache ID L1dl1il2 string `json:"l1dl1il2"` // L3 cache ID L3 int32 `json:"l3"` // online Online string `json:"online"` }
ProcessorInfo describes the processor topology information of a single logic cpu, including the core, socket and numa node it belongs to
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
handler/mockclient
Package mock_client is a generated GoMock package.
|
Package mock_client is a generated GoMock package. |