Skip to content

Instantly share code, notes, and snippets.

@cloudaice
Created April 29, 2014 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cloudaice/11399037 to your computer and use it in GitHub Desktop.
Save cloudaice/11399037 to your computer and use it in GitHub Desktop.
测试CPU使用情况
package main
import (
"runtime"
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
forfunc := func() {
for {
a := 6
a = a | a
}
}
for i := 0; i < 32; i++ {
go forfunc()
}
forfunc()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment