Documentation ¶
Overview ¶
Package cpux provides information about a system's cpus, where X is the integer of each CPU on the system, e.g. cpu0, cpu1, etc. On linux systems this comes from the sysfs filesystem. Not all paths are available on all systems, e.g. /sys/devices/system/cpu/cpuX/cpufreq and its children may not exist on some systems. If the system doesn't have a particular path within this path, the field's value will be the type's zero value.
This package does not currently have a ticker implementation.
Index ¶
- Constants
- type CPU
- type CPUs
- type Profiler
- func (prof *Profiler) Get() (*CPUs, error)
- func (prof *Profiler) Offline() (string, error)
- func (prof *Profiler) Online() (string, error)
- func (prof *Profiler) Possible() (string, error)
- func (prof *Profiler) Present() (string, error)
- func (prof *Profiler) Reset() error
- func (prof *Profiler) SysFSSystemPath(s string)
Constants ¶
const ( CPUFreq = "cpufreq" Offline = "offline" Online = "online" Possible = "possible" Present = "present" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CPU ¶
type CPU struct { PhysicalPackageID int32 `json:"physical_package_id"` CoreID int32 `json:"core_id"` MHzMin float32 `json:"mhz_min"` MHzMax float32 `json:"mhz_max"` Cache map[string]string `json:"cache:` // a sorted list of caches so that the cache info can be pulled out in order. CacheIDs []string `json:"cache_id"` }
type CPUs ¶
type Profiler ¶
type Profiler struct { // this is an exported fied for testing purposes. It should not be set in // non-test usage NumCPU int // contains filtered or unexported fields }
Profiler is used to process the system's cpuX information.
func NewProfiler ¶
func NewProfiler() (prof *Profiler)
Returns an initialized Profiler; ready to use.
func (*Profiler) Get ¶
Get the cpuX info for each cpu. Currently only min and max frequency are implemented.
func (*Profiler) Offline ¶
Offline: CPUs that are not online because they have been HOTPLUGGED off (see cpu-hotplug.txt) or exceed the limit of CPUs allowed by the kernel configuration (kernel_max above). [~cpu_online_mask + cpus >= NR_CPUS]. from: Documentation/cputopology.txt
This file may not exist or may only contain a new line char, '\n', neither of these conditions are error states and will result in an empty string.
func (*Profiler) Online ¶
Online: CPUs that are online and being scheduled [cpu_online_mask] from: Documentation/cputopology.txt
func (*Profiler) Possible ¶
Possible: CPUs that have been allocated resources and can be brought online if they are present. [cpu_possible_mask] from: Documentation/cputopology.txt
func (*Profiler) Present ¶
Present: CPUs that have been identified as being present in the system. [cpu_present_mask] from: Documentation/cputopology.txt
func (*Profiler) SysFSSystemPath ¶
SysFSSystemPath enables overriding the default value. This is for testing and should be used outside of tests.
Directories ¶
Path | Synopsis |
---|---|
Package cpux provides information about a system's cpus, where X is the integer of each CPU on the system, e.g.
|
Package cpux provides information about a system's cpus, where X is the integer of each CPU on the system, e.g. |
Package cpux provides information about a system's cpus, where X is the integer of each CPU on the system, e.g.
|
Package cpux provides information about a system's cpus, where X is the integer of each CPU on the system, e.g. |