Go - benchmark profile CPU and Memory
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_cpu.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_cpu.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_cpu.pprof
zzh@ZZHPC:/zdata/MyPrograms/Go/aaa$ go test -run NONE -bench . -benchmem
goos: linux
goarch: amd64
pkg: zzh/aaa
cpu: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
BenchmarkTokenize-6 61143 19571 ns/op 10739 B/op 125 allocs/op
PASS
ok zzh/aaa 1.398s
zzh@ZZHPC:/zdata/MyPrograms/Go/aaa$ go test -run NONE -bench . -memprofile=tokenizer_mem.pprof
goos: linux
goarch: amd64
pkg: zzh/aaa
cpu: Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz
BenchmarkTokenize-6 60507 19426 ns/op
PASS
ok zzh/aaa 1.380s
zzh@ZZHPC:/zdata/MyPrograms/Go/aaa$ go tool pprof -http=:8080 tokenizer_mem.pprof
Serving web UI on http://localhost:8080