2 回答

TA貢獻(xiàn)1784條經(jīng)驗(yàn) 獲得超9個(gè)贊
Go 運(yùn)行時(shí)跟蹤工具將幫助您進(jìn)行跟蹤,但您需要在 go code start 中添加跟蹤選項(xiàng)
package main
import (
"os"
"runtime/trace"
)
func main() {
trace.Start(os.Stderr) //start the trace
defer trace.Stop() // defer to the end
.... //rest of the code
}
然后使用,
go run main.go 2> trace.out
then use the trace tool
go tool trace trace.out.
此鏈接包含更多信息https://blog.gopheracademy.com/advent-2017/go-execution-tracer/

TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超6個(gè)贊
[I]如果有一個(gè) API 中有各種 goroutine,并且在這些 goroutine 中,其他 goroutine 會(huì)被調(diào)用,[...]
沒(méi)有。
- 2 回答
- 0 關(guān)注
- 154 瀏覽
添加回答
舉報(bào)