numcpu

package
v0.10.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 3

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL