Skip to content

Instantly share code, notes, and snippets.

@assafmo
Last active April 18, 2020 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save assafmo/312cce323834c5ad592bf3adc29063e6 to your computer and use it in GitHub Desktop.
Save assafmo/312cce323834c5ad592bf3adc29063e6 to your computer and use it in GitHub Desktop.
Golang Flame Graphs
package main

import "runtime/pprof"

func main() {
	pprof.StartCPUProfile(os.Stderr)
	defer pprof.StopCPUProfile()

  // ...
}
go get -u github.com/google/pprof
go run main.go 2> cpu.pprof

sudo apt install -y graphviz
go tool pprof -http=:8080 cpu.pprof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment