Skip to content

stefafafan/pprof-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pprof-helper

A helper for using Go's pprof package with web applications. For now, it just prints out pseudocode.

Installation

go install github.com/stefafafan/pprof-helper

Usage

Go to the directory with go.mod and call the helper. The helper will go through your go.mod and for now just print out pseudocode that matches the used web framework.

$ cd your-go-project
$ pprof-helper
For goji, update the code like this:
import (
	"net/http/pprof"
)

func main() {
	mux := goji.NewMux()

	mux.HandleFunc(pat.Get("/debug/pprof/"), pprof.Index)
	mux.HandleFunc(pat.Get("/debug/pprof/cmdline"), pprof.Cmdline)
	mux.HandleFunc(pat.Get("/debug/pprof/profile"), pprof.Profile)
	mux.HandleFunc(pat.Get("/debug/pprof/symbol"), pprof.Symbol)
}

You can also specify --go-mod-file option, which is the path of the go.mod instead of moving to that directory.

$ pprof-helper --go-mod-file=./my-go-project/go.mod

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Languages