37bfa58c5f1094a20da8392ad5646defe83951fe
[govpp.git] / vendor / github.com / pkg / profile / README.md
1 profile
2 =======
3
4 Simple profiling support package for Go
5
6 [![Build Status](https://travis-ci.org/pkg/profile.svg?branch=master)](https://travis-ci.org/pkg/profile) [![GoDoc](http://godoc.org/github.com/pkg/profile?status.svg)](http://godoc.org/github.com/pkg/profile)
7
8
9 installation
10 ------------
11
12     go get github.com/pkg/profile
13
14 usage
15 -----
16
17 Enabling profiling in your application is as simple as one line at the top of your main function
18
19 ```go
20 import "github.com/pkg/profile"
21
22 func main() {
23     defer profile.Start().Stop()
24     ...
25 }
26 ```
27
28 options
29 -------
30
31 What to profile is controlled by config value passed to profile.Start. 
32 By default CPU profiling is enabled.
33
34 ```go
35 import "github.com/pkg/profile"
36
37 func main() {
38     // p.Stop() must be called before the program exits to
39     // ensure profiling information is written to disk.
40     p := profile.Start(profile.MemProfile, profile.ProfilePath("."), profile.NoShutdownHook)
41     ...
42 }
43 ```
44
45 Several convenience package level values are provided for cpu, memory, and block (contention) profiling.
46
47 For more complex options, consult the [documentation](http://godoc.org/github.com/pkg/profile).
48
49 contributing
50 ------------
51
52 We welcome pull requests, bug fixes and issue reports.
53
54 Before proposing a change, please discuss it first by raising an issue.