Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NumCPU ¶
func NumCPU() int
NumCPU is a drop-in replacement for runtime.NumCPU for accurate system config reporting. runtime.NumCPU doesn't query any kind of hardware or OS state, but merely uses affinity APIs to count what CPUs the given go process is available to run on. Most of the time this works okay for reporting metrics, but under certain conditions, such as cases where affinity masks are being manually set to manage the go process, or certain job controllers/VMs/etc, this number will not reflect the system config. Because this is drop-in, it will not return an error. if it can't fetch the CPU count the "correct" way, it'll fallback to runtime.NumCPU().
Types ¶
This section is empty.