mirror of
https://github.com/yanfeizhang/coder-kung-fu.git
synced 2026-05-11 00:48:29 +08:00
31 lines
386 B
Go
31 lines
386 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
"runtime"
|
|
)
|
|
|
|
func cal() {
|
|
for i :=0 ; i<1000000 ;i++{
|
|
//fmt.Printf("call:%d\n",i)
|
|
runtime.Gosched()
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
runtime.GOMAXPROCS(1)
|
|
|
|
currentTime:=time.Now()
|
|
fmt.Println(currentTime)
|
|
|
|
go cal()
|
|
for i :=0 ; i<1000000 ;i++{
|
|
//fmt.Printf("main:%d\n",i)
|
|
runtime.Gosched()
|
|
}
|
|
|
|
currentTime=time.Now()
|
|
fmt.Println(currentTime)
|
|
}
|