package winstats
import "k8s.io/kubernetes/pkg/kubelet/winstats"
Package winstats provides a client to get node and pod level stats on windows
Package winstats provides a client to get node and pod level stats on windows
Index ¶
- func CpusToGroupAffinity(cpus []int) map[int]*GroupAffinity
- func ProcessorCount() int
- type Client
- type GroupAffinity
- func GetCPUsforNUMANode(nodeNumber uint16) (*GroupAffinity, error)
- func (a GroupAffinity) MaskString() string
- func (a GroupAffinity) Processors() []int
- type MemoryStatusEx
- type OSInfo
- func GetOSInfo() (*OSInfo, error)
- func (o *OSInfo) GetBuild() string
- func (o *OSInfo) GetPatchVersion() string
- type PerformanceInformation
- type StatsClient
- func (c *StatsClient) GetDirFsInfo(path string) (cadvisorapiv2.FsInfo, error)
- func (c *StatsClient) WinContainerInfos() (map[string]cadvisorapiv2.ContainerInfo, error)
- func (c *StatsClient) WinMachineInfo() (*cadvisorapi.MachineInfo, error)
- func (c *StatsClient) WinVersionInfo() (*cadvisorapi.VersionInfo, error)
Functions ¶
func CpusToGroupAffinity ¶
func CpusToGroupAffinity(cpus []int) map[int]*GroupAffinity
CpusToGroupAffinity converts a list of CPUs to a map of GroupAffinity split by windows CPU group. Windows doesn't track processors by ID but kubelet converts them to a number and this function goes in reverse.
func ProcessorCount ¶
func ProcessorCount() int
ProcessorCount returns the number of logical processors on the system. runtime.NumCPU() will only return the information for a single Processor Group. Since a single group can only hold 64 logical processors, this means when there are more they will be divided into multiple groups. For the above reason, procGetActiveProcessorCount is used to get the cpu count for all processor groups of the windows node. more notes for this issue: same issue in moby: https://github.com/moby/moby/issues/38935#issuecomment-744638345 solution in hcsshim: https://github.com/microsoft/hcsshim/blob/master/internal/processorinfo/processor_count.go
Types ¶
type Client ¶
type Client interface { WinContainerInfos() (map[string]cadvisorapiv2.ContainerInfo, error) WinMachineInfo() (*cadvisorapi.MachineInfo, error) WinVersionInfo() (*cadvisorapi.VersionInfo, error) GetDirFsInfo(path string) (cadvisorapiv2.FsInfo, error) }
Client is an interface that is used to get stats information.
func NewPerfCounterClient ¶
NewPerfCounterClient creates a client using perf counters
type GroupAffinity ¶
GroupAffinity represents the processor group affinity of cpus https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-group_affinity
func GetCPUsforNUMANode ¶
func GetCPUsforNUMANode(nodeNumber uint16) (*GroupAffinity, error)
GetCPUsForNUMANode queries the system for the CPUs that are part of the given NUMA node.
func (GroupAffinity) MaskString ¶
func (a GroupAffinity) MaskString() string
MaskString returns the affinity mask as a string of 0s and 1s
func (GroupAffinity) Processors ¶
func (a GroupAffinity) Processors() []int
Processors returns a list of processors ids that are part of the affinity mask Windows doesn't track processors by ID but kubelet converts them to a number
type MemoryStatusEx ¶
type MemoryStatusEx struct { Length uint32 MemoryLoad uint32 TotalPhys uint64 AvailPhys uint64 TotalPageFile uint64 AvailPageFile uint64 TotalVirtual uint64 AvailVirtual uint64 AvailExtendedVirtual uint64 }
MemoryStatusEx is the same as Windows structure MEMORYSTATUSEX https://msdn.microsoft.com/en-us/library/windows/desktop/aa366770(v=vs.85).aspx
type OSInfo ¶
OSInfo is a convenience class for retrieving Windows OS information
func GetOSInfo ¶
GetOSInfo reads Windows version information from the registry
func (*OSInfo) GetBuild ¶
GetBuild returns OS version upto build number
func (*OSInfo) GetPatchVersion ¶
GetPatchVersion returns full OS version with patch
type PerformanceInformation ¶
type PerformanceInformation struct { CommitTotalPages uint64 CommitLimitPages uint64 CommitPeakPages uint64 PhysicalTotalPages uint64 PhysicalAvailablePages uint64 SystemCachePages uint64 KernelTotalPages uint64 KernelPagesPages uint64 KernelNonpagedPages uint64 PageSize uint64 HandleCount uint32 ProcessCount uint32 ThreadCount uint32 // contains filtered or unexported fields }
PerformanceInfo is the same as Windows structure PERFORMANCE_INFORMATION https://learn.microsoft.com/en-us/windows/win32/api/psapi/ns-psapi-performance_information
func GetPerformanceInfo ¶
func GetPerformanceInfo() (*PerformanceInformation, error)
type StatsClient ¶
type StatsClient struct {
// contains filtered or unexported fields
}
StatsClient is a client that implements the Client interface
func (*StatsClient) GetDirFsInfo ¶
func (c *StatsClient) GetDirFsInfo(path string) (cadvisorapiv2.FsInfo, error)
GetDirFsInfo returns filesystem capacity and usage information.
func (*StatsClient) WinContainerInfos ¶
func (c *StatsClient) WinContainerInfos() (map[string]cadvisorapiv2.ContainerInfo, error)
WinContainerInfos returns a map of container infos. The map contains node and pod level stats. Analogous to cadvisor GetContainerInfoV2 method.
func (*StatsClient) WinMachineInfo ¶
func (c *StatsClient) WinMachineInfo() (*cadvisorapi.MachineInfo, error)
WinMachineInfo returns a cadvisorapi.MachineInfo with details about the node machine. Analogous to cadvisor MachineInfo method.
func (*StatsClient) WinVersionInfo ¶
func (c *StatsClient) WinVersionInfo() (*cadvisorapi.VersionInfo, error)
WinVersionInfo returns a cadvisorapi.VersionInfo with version info of the kernel and docker runtime. Analogous to cadvisor VersionInfo method.
Source Files ¶
cpu_topology.go doc.go network_stats.go perfcounter_nodestats_windows.go perfcounters.go version.go winstats.go
- Version
- v1.33.2
- Published
- Jun 17, 2025
- Platform
- windows/amd64
- Imports
- 21 packages
- Last checked
- 23 seconds ago –
Tools for package owners.