go vendor
This commit is contained in:
19
vendor/github.com/revel/modules/pprof/README.md
generated
vendored
Normal file
19
vendor/github.com/revel/modules/pprof/README.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Revel pprof module
|
||||
============
|
||||
|
||||
#### How to use:
|
||||
|
||||
1. Open your app.conf file and add the following line:
|
||||
`module.pprof=github.com/revel/modules/pprof`
|
||||
This will enable the pprof module.
|
||||
|
||||
2. Next, open your routes file and add:
|
||||
`module:pprof` **Note:** Do not change these routes. The pprof command-line tool by default assumes these routes.
|
||||
|
||||
Congrats! You can now profile your application. To use the web interface, visit `http://<host>:<port>/debug/pprof`. You can also use the `go tool pprof` command to profile your application and get a little deeper. Use the command by running `go tool pprof <binary> http://<host>:<port>`. For example, if you modified the booking sample, you would run: `go tool pprof $GOPATH/bin/booking http://localhost:9000` (assuming you used the default `revel run` arguments.
|
||||
|
||||
The command-line tool will take a 30-second CPU profile, and save the results to a temporary file in your `$HOME/pprof` directory. You can reference this file at a later time by using the same command as above, but by specifying the filename instead of the server address.
|
||||
|
||||
In order to fully utilize the command-line tool, you may need the graphviz utilities. If you're on OS X, you can install these easily using Homebrew: `brew install graphviz`.
|
||||
|
||||
To read more about profiling Go programs, here is some reading material: [The Go Blog](http://blog.golang.org/profiling-go-programs) : [net/pprof package documentation](http://golang.org/pkg/net/http/pprof/)
|
39
vendor/github.com/revel/modules/pprof/app/controllers/pprof.go
generated
vendored
Normal file
39
vendor/github.com/revel/modules/pprof/app/controllers/pprof.go
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/revel/revel"
|
||||
"net/http"
|
||||
"net/http/pprof"
|
||||
)
|
||||
|
||||
type Pprof struct {
|
||||
*revel.Controller
|
||||
}
|
||||
|
||||
// The PprofHandler type makes it easy to call the net/http/pprof handler methods
|
||||
// since they all have the same method signature
|
||||
type PprofHandler func(http.ResponseWriter, *http.Request)
|
||||
|
||||
func (r PprofHandler) Apply(req *revel.Request, resp *revel.Response) {
|
||||
r(resp.Out.Server.GetRaw().(http.ResponseWriter), req.In.GetRaw().(*http.Request))
|
||||
}
|
||||
|
||||
func (c Pprof) Profile() revel.Result {
|
||||
return PprofHandler(pprof.Profile)
|
||||
}
|
||||
|
||||
func (c Pprof) Symbol() revel.Result {
|
||||
return PprofHandler(pprof.Symbol)
|
||||
}
|
||||
|
||||
func (c Pprof) Cmdline() revel.Result {
|
||||
return PprofHandler(pprof.Cmdline)
|
||||
}
|
||||
|
||||
func (c Pprof) Trace() revel.Result {
|
||||
return PprofHandler(pprof.Trace)
|
||||
}
|
||||
|
||||
func (c Pprof) Index() revel.Result {
|
||||
return PprofHandler(pprof.Index)
|
||||
}
|
6
vendor/github.com/revel/modules/pprof/conf/routes
generated
vendored
Normal file
6
vendor/github.com/revel/modules/pprof/conf/routes
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
GET /debug/pprof/profile Pprof.Profile
|
||||
GET /pprof/symbol Pprof.Symbol
|
||||
GET /debug/pprof/cmdline Pprof.Cmdline
|
||||
GET /debug/pprof/trace Pprof.Trace
|
||||
GET /debug/pprof/* Pprof.Index
|
||||
GET /debug/pprof/ Pprof.Index
|
3
vendor/github.com/revel/modules/pprof/pprof.go
generated
vendored
Normal file
3
vendor/github.com/revel/modules/pprof/pprof.go
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
package pprof
|
||||
|
||||
// Required for vendoring see golang.org/issue/13832
|
Reference in New Issue
Block a user