Find out how many logical processors used by current process


NumCPU returns the number of logical CPUs usable by the current process.

Example

package main

import (
	"fmt"
	"runtime"
)

func main() {
	fmt.Println(runtime.NumCPU())
}
Most Helpful This Week