httppprof

package module
v0.0.0-...-c756918 Latest Latest
Warning

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

Go to latest
Published: May 22, 2014 License: BSD-3-Clause Imports: 13 Imported by: 0

README

http pprof

Minimal fork of net/http/pprof that just removes the import side effect.

See http://godoc.org/github.com/lytics/httppprof for how to use the new API.

Honestly, you should probably just never use the default HTTP mux for non-trivial apps. Then you don't need this fork.

Documentation

Overview

Package pprof serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool. For more information about pprof, see http://code.google.com/p/google-perftools/.

Unlike net/http/pprof, this package does not register HTTP handlers on import.

To use pprof, pass a HTTP ServeMux to Register:

httppprof.Register(http.DefaultServeMux)
log.Println(http.ListenAndServe("localhost:6060", nil))

Then use the pprof tool to look at the heap profile:

go tool pprof http://localhost:6060/debug/pprof/heap

Or to look at a 30-second CPU profile:

go tool pprof http://localhost:6060/debug/pprof/profile

Or to look at the goroutine blocking profile:

go tool pprof http://localhost:6060/debug/pprof/block

To view all available profiles, open http://localhost:6060/debug/pprof/ in your browser.

For a study of the facility in action, visit

http://blog.golang.org/2011/06/profiling-go-programs.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmdline

func Cmdline(w http.ResponseWriter, r *http.Request)

Cmdline responds with the running program's command line, with arguments separated by NUL bytes. The package initialization registers it as /debug/pprof/cmdline.

func Handler

func Handler(name string) http.Handler

Handler returns an HTTP handler that serves the named profile.

func Index

func Index(w http.ResponseWriter, r *http.Request)

Index responds with the pprof-formatted profile named by the request. For example, "/debug/pprof/heap" serves the "heap" profile. Index responds to a request for "/debug/pprof/" with an HTML page listing the available profiles.

func Profile

func Profile(w http.ResponseWriter, r *http.Request)

Profile responds with the pprof-formatted cpu profile. The package initialization registers it as /debug/pprof/profile.

func Register

func Register(m *http.ServeMux)

func Symbol

func Symbol(w http.ResponseWriter, r *http.Request)

Symbol looks up the program counters listed in the request, responding with a table mapping program counters to function names. The package initialization registers it as /debug/pprof/symbol.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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