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
Regular expression for matching HH:MM time format in Golang
Convert Int data type to Int16 Int32 Int64
Example to compare Println vs Printf
Subtract N number of Year, Month, Day, Hour, Minute, Second, Millisecond, Microsecond and Nanosecond to current date-time.
Example to handle GET and POST request in Golang
How to check string contains uppercase lowercase character in Golang?