pprof-helper

command module
v0.0.0-...-0131123 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2023 License: MIT Imports: 4 Imported by: 0

README

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

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL