zzh@ZZHPC:/zdata/MyPrograms/Go/aaa$ go test -run NONE -bench .
goos: linux
goarch: amd64
pkg: zzh/aaa
cpu: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
BenchmarkTokenize-6 60164 19742 ns/op
PASS
ok zzh/aaa 1.392s
zzh@ZZHPC:/zdata/MyPrograms/Go/aaa$ go test -run NONE -bench . -cpuprofile=tokenizer.pprof
goos: linux
goarch: amd64
pkg: zzh/aaa
cpu: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
BenchmarkTokenize-6 58401 19679 ns/op
PASS
ok zzh/aaa 1.508s
zzh@ZZHPC:/zdata/MyPrograms/Go/aaa$ go tool pprof -http=:8080 tokenizer.pprof
Serving web UI on http://localhost:8080
Failed to execute dot. Is Graphviz installed?
exec: "dot": executable file not found in $PATH
Failed to execute dot. Is Graphviz installed?
exec: "dot": executable file not found in $PATH
^Cgo tool pprof: signal: interrupt
zzh@ZZHPC:/zdata/MyPrograms/Go/aaa$ sudo apt install graphviz
zzh@ZZHPC:/zdata/MyPrograms/Go/aaa$ go tool pprof -http=:8080 tokenizer.pprof
标签:ZZHPC,aaa,cpuprofile,benchmark,MyPrograms,zzh,Go,zdata From: https://www.cnblogs.com/zhangzhihui/p/17679830.html