Go标准库
Go标准库 runtime运行环境
- **GOROOT() string**:返回Go的根目录。 - **Version() string**:返回Go的版本字符串 - **NumCPU() int**:返回本地机器的逻辑CPU个数。 - **GOMAXPROCS(n int) int**:设置可同时执行的最大CPU数,并返回先前的设置。 - **SetCPUProfileRate(hz int)**:设置CPU profile记录的速率为平均每秒hz次。 - **CPUProfile() []byte**:返回二进制CPU profile堆栈跟踪数据的下一个chunk,函数会阻塞直到该数据可用 - **GC()**:执行一次垃圾回收。 - **SetFinalizer(x, f interface{})**:将x的终止器设置为f - **MemProfile(p []MemProfileRecord, inuseZero bool) (n int, ok bool)**:返回当前内存profile中的记录数n。。 - **Breakpoint()**:执行一个断点陷阱。 - **Stack(buf []byte, all bool) int**:将调用其的go程的调用栈踪迹格式化后写入到buf中并返回写入的字节数 - **Caller(skip int) (pc uintptr, file string, line int, ok bool)**:报告当前go程调用栈所执行的函数的文件和行号信息 - **Callers(skip int, pc []uintptr) int**:把当前go程调用栈上的调用栈标识符填入切片pc中,返回写入到pc中的项数 - **NumCgoCall() int64**:返回当前进程执行的cgo调用次数。 - **NumGoroutine() int**:返回当前存在的Go程数。 - **Goexit()**:终止调用它的go程。其它go程不会受影响。Goexit会在终止该go程前执行所有defer的函数。 - **Gosched()**:使当前go程放弃处理器,以让其它go程运行。它不会挂起当前go程,因此当前go程未来会恢复执行。 - **GoroutineProfile(p []StackRecord) (n int, ok bool)**:返回活跃go程的堆栈profile中的记录个数 - **LockOSThread()**:将调用的go程绑定到它当前所在的操作系统线程 - **UnlockOSThread()**:将调用的go程解除和它绑定的操作系统线程 - **ThreadCreateProfile(p []StackRecord) (n int, ok bool)**:返回线程创建profile中的记录个数 - **SetBlockProfileRate(rate int)**:控制阻塞profile记录go程阻塞事件的采样频率 - **BlockProfile(p []BlockProfileRecord) (n int, ok bool)**:返回当前阻塞profile中的记录个数
顶部
收展
底部
[TOC]
目录
Go标准库 fmt格式化操作
Go标准库 time时间接口
Go标准库 strings字符串
Go标准库 strconv字符串转换
Go标准库 sort排序
Go标准库 runtime运行环境
Go标准库 sync同步操作
Go标准库 atomic原子性
Go标准库 path路径
Go标准库 filepath文件路径
Go标准库 http
相关推荐
Gin框架