Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
// TotalCores is the total number of physical cores the host system
// contains
TotalCores uint32 `json:"total_cores"`
// TotalThreads is the total number of hardware threads the host system
// contains
TotalHardwareThreads uint32 `json:"total_hardware_threads"`
// TotalThreads is the total number of hardware threads the host system
// contains
// DEPRECATED: Use `TotalHardwareThreads` instead
TotalThreads uint32 `json:"total_threads"`
// Processors is a slice of Processor struct pointers, one for each
// physical processor package contained in the host
Processors []*Processor `json:"processors"`
// contains filtered or unexported fields
}
Info describes all central processing unit (CPU) functionality on a host. Returned by the `ghw.CPU()` function.
func New ¶
New returns a pointer to an Info struct that contains information about the CPUs on the host system
func (*Info) JSONString ¶
JSONString returns a string with the cpu information formatted as JSON under a top-level "cpu:" key
func (*Info) YAMLString ¶
YAMLString returns a string with the cpu information formatted as YAML under a top-level "cpu:" key
type Processor ¶
type Processor struct {
// ID is the physical processor `uint32` ID according to the system
ID int `json:"id"`
// TotalCores is the number of physical cores in the processor package
TotalCores uint32 `json:"total_cores"`
// NumCores is the number of physical cores in the processor package
// DEPRECATED: Use `TotalCores` instead.
NumCores uint32 `json:"-"`
// TotalHardwareThreads is the number of hardware threads associated with
// the processor package
TotalHardwareThreads uint32 `json:"total_hardware_threads"`
// NumThreads is the number of hardware threads in the processor package
// DEPRECATED: Use `TotalHardwareThreads` instead.
NumThreads uint32 `json:"total_threads"`
// Vendor is a string containing the vendor name
Vendor string `json:"vendor"`
// Model` is a string containing the vendor's model name
Model string `json:"model"`
// Capabilities is a slice of strings indicating the features the processor
// has enabled
Capabilities []string `json:"capabilities"`
// Cores is a slice of ProcessorCore` struct pointers that are packed onto
// this physical processor
Cores []*ProcessorCore `json:"cores"`
}
Processor describes a physical host central processing unit (CPU).
func (*Processor) CoreByID ¶
func (p *Processor) CoreByID(coreID int) *ProcessorCore
CoreByID returns the ProcessorCore having the supplied ID.
func (*Processor) HasCapability ¶
HasCapability returns true if the Processor has the supplied cpuid capability, false otherwise. Example of cpuid capabilities would be 'vmx' or 'sse4_2'. To see a list of potential cpuid capabilitiies, see the section on CPUID feature bits in the following article:
type ProcessorCore ¶
type ProcessorCore struct {
// ID is the `uint32` identifier that the host gave this core. Note that
// this does *not* necessarily equate to a zero-based index of the core
// within a physical package. For example, the core IDs for an Intel Core
// i7 are 0, 1, 2, 8, 9, and 10
ID int `json:"id"`
// TotalHardwareThreads is the number of hardware threads associated with
// the core
TotalHardwareThreads uint32 `json:"total_hardware_threads"`
// NumThreads is the number of hardware threads associated with the core.
// DEPRECATED: Use `TotalHardwareThreads` instead.
NumThreads uint32 `json:"total_threads"`
// LogicalProcessors is a slice of ints representing the logical processor
// IDs assigned to any processing unit for the core. These are sometimes
// called the "thread siblings". Logical processor IDs are the *zero-based*
// index of the processor on the host and are *not* related to the core ID.
LogicalProcessors []int `json:"logical_processors"`
}
ProcessorCore describes a physical host processor core. A processor core is a separate processing unit within some types of central processing units (CPU).
func CoresForNode ¶
func CoresForNode(ctx *context.Context, nodeID int) ([]*ProcessorCore, error)
func (*ProcessorCore) String ¶
func (c *ProcessorCore) String() string
String returns a short string indicating important information about the processor core