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
Golang download image from given URL
How to remove symbols from a string in Golang?
Different ways to convert Byte Array into String
Add N number of Year, Month, Day, Hour, Minute, Second, Millisecond, Microsecond and Nanosecond to current date-time
How to kill execution of goroutine?
Regular Expression to get a string between parentheses in Golang