
* pkg/proc: use golang.org/x/arch/x86/x86asm instead of rsc.io/x86/x86asm * pkg/dwarf: migrate to github.com/pkg/profile from github.com/davecheney/profile * scripts: keep script go files from being considered for the build scripts/gen-*.go files are scripts for generating documentation files and don't follow the typical Go package layout. Expected usage is like go run scripts/gen-cli-docs.go * vendor: update vendored packages There were many changes in delve, and go tool chains since last vendored package update. I just rerun godpes from scratch. $ rm vendor/* $ rm Godeps/Godeps.json $ go list ./... | grep -v /vendor/ | grep -v /scripts/ | go get -u -t $ go get -u github.com/mattn/go-colorable $ go get -u github.com/mattn/go-isatty $ go list ./... | grep -v /vendor/ | grep -v /scripts/ | godeps save
55 lines
1.3 KiB
Markdown
55 lines
1.3 KiB
Markdown
profile
|
|
=======
|
|
|
|
Simple profiling support package for Go
|
|
|
|
[](https://travis-ci.org/pkg/profile) [](http://godoc.org/github.com/pkg/profile)
|
|
|
|
|
|
installation
|
|
------------
|
|
|
|
go get github.com/pkg/profile
|
|
|
|
usage
|
|
-----
|
|
|
|
Enabling profiling in your application is as simple as one line at the top of your main function
|
|
|
|
```go
|
|
import "github.com/pkg/profile"
|
|
|
|
func main() {
|
|
defer profile.Start().Stop()
|
|
...
|
|
}
|
|
```
|
|
|
|
options
|
|
-------
|
|
|
|
What to profile is controlled by config value passed to profile.Start.
|
|
By default CPU profiling is enabled.
|
|
|
|
```go
|
|
import "github.com/pkg/profile"
|
|
|
|
func main() {
|
|
// p.Stop() must be called before the program exits to
|
|
// ensure profiling information is written to disk.
|
|
p := profile.Start(profile.MemProfile, profile.ProfilePath("."), profile.NoShutdownHook)
|
|
...
|
|
}
|
|
```
|
|
|
|
Several convenience package level values are provided for cpu, memory, and block (contention) profiling.
|
|
|
|
For more complex options, consult the [documentation](http://godoc.org/github.com/pkg/profile).
|
|
|
|
contributing
|
|
------------
|
|
|
|
We welcome pull requests, bug fixes and issue reports.
|
|
|
|
Before proposing a change, please discuss it first by raising an issue.
|