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
Functions mess (recursive anonymous function) in Golang
Example: How to use ReadAtLeast from IO Package in Golang?
Regular expression to validate the date format in "dd/mm/yyyy"
How to collect information about garbage collection?
How to find out element position in slice?
How to add and update elements in Map?