Is there a simple way to find out the number of CPU's on a local machine using Go lang?
Asked
Active
Viewed 3.4k times
60
-
possible duplicate of [Golang: how to verify number of processors on which a Go program is running](http://stackoverflow.com/questions/13234749/golang-how-to-verify-number-of-processors-on-which-a-go-program-is-running) – squiguy Jun 06 '14 at 03:25
1 Answers
96
http://play.golang.org/p/cuaf2ZHLIx
package main
import (
"fmt"
"runtime"
)
func main() {
fmt.Println(runtime.NumCPU())
}

Eve Freeman
- 32,467
- 4
- 86
- 101