CPUs
Overview
CPUs returns the number of logical CPUs.
If you are coming from Node.js, the closest pattern is os.cpus().length.
Signature
go
func CPUs() intCompare: Node.js · Standard Go · gox
js
os.cpus().lengthgo
// Use the underlying stdlib or driver directly.
// See package overview for escape hatches.go
import "github.com/sahilkhaire/gox/osutil"
osutil.CPUs()Example
go
import "github.com/sahilkhaire/gox/osutil"
osutil.CPUs()Tips
Import github.com/sahilkhaire/gox/osutil and call CPUs directly. See the comparison below for the standard library equivalent.
Standard library alternative
gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.