go package学习——runtime
package runtime主要是与go的runtime系统进行互动操作,例如控制goroutine的函数等。它也包含 reflect package 所需的低等级信息。 1. Environment Variables GOGC: 设置初始的垃圾回收百分比。默认值为 GOGC=100 ;如果设置 GOGC=off,则会完全关闭垃圾回收功能。 runtime/debug package的SetGCPercent 函数可以在运行时改变其值。 GOGCTRACE: 从垃圾回收处控制debug输出。 GOMAXPROCS : 控制同时运行用户态go程序的操作系统线程数。 GOTRACEBACK : 控制错误导致的输出数量。 GOARCH, GOOS, GOPATH, GOROOT : 386或amd64、linux或windows、开发目录、安装目录。 Index Constants Variables func BlockProfile(p []BlockProfileRecord) (n int, ok bool) func Breakpoint() func CPUProfile() []byte func Caller(skip int) (pc uintptr, file string, line int, ok bool) func Callers(skip int, pc