Documentation ¶
Overview ¶
Package numcpus provides information about the number of CPU.
It gets the number of CPUs (online, offline, present, possible or kernel maximum) on a Linux, Darwin, FreeBSD, NetBSD, OpenBSD or DragonflyBSD system.
On Linux, the information is retrieved by reading the corresponding CPU topology files in /sys/devices/system/cpu.
Not all functions are supported on Darwin, FreeBSD, NetBSD, OpenBSD and DragonflyBSD.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotSupported = errors.New("function not supported")
ErrNotSupported is the error returned when the function is not supported.
Functions ¶
func GetConfigured ¶
GetConfigured returns the number of CPUs configured on the system. This function should return the same value as `getconf _SC_NPROCESSORS_CONF` on a unix system.
func GetKernelMax ¶
GetKernelMax returns the maximum number of CPUs allowed by the kernel configuration. This function is only supported on Linux systems.
func GetOffline ¶
GetOffline returns the number of offline CPUs, i.e. CPUs that are not online because they have been hotplugged off or exceed the limit of CPUs allowed by the kernel configuration (see GetKernelMax). This function is only supported on Linux systems.
func GetPossible ¶
GetPossible returns the number of possible CPUs, i.e. CPUs that have been allocated resources and can be brought online if they are present.
func GetPresent ¶
GetPresent returns the number of CPUs present in the system.
Types ¶
This section is empty.