golang.org/toolchain@v0.0.1-go1.9rc2.windows-amd64/src/cmd/vendor/github.com/google/pprof/README.md (about) 1 # Introduction 2 3 pprof is a tool for visualization and analysis of profiling data. 4 5 pprof reads a collection of profiling samples in profile.proto format and 6 generates reports to visualize and help analyze the data. It can generate both 7 text and graphical reports (through the use of the dot visualization package). 8 9 profile.proto is a protocol buffer that describes a set of callstacks 10 and symbolization information. A common usage is to represent a set of 11 sampled callstacks from statistical profiling. The format is 12 described on the [proto/profile.proto](./proto/profile.proto) file. For details on protocol 13 buffers, see https://developers.google.com/protocol-buffers 14 15 Profiles can be read from a local file, or over http. Multiple 16 profiles of the same type can be aggregated or compared. 17 18 If the profile samples contain machine addresses, pprof can symbolize 19 them through the use of the native binutils tools (addr2line and nm). 20 21 **This is not an official Google product.** 22 23 # Building pprof 24 25 Prerequisites: 26 27 - Go development kit. Known to work with Go 1.5. 28 Follow [these instructions](http://golang.org/doc/code.html) to install the 29 go tool and set up GOPATH. 30 31 - Graphviz: http://www.graphviz.org/ 32 Optional, used to generate graphic visualizations of profiles 33 34 To build and install it, use the `go get` tool. 35 36 go get github.com/google/pprof 37 38 # Basic usage 39 40 pprof can read a profile from a file or directly from a server via http. 41 Specify the profile input(s) in the command line, and use options to 42 indicate how to format the report. 43 44 ## Generate a text report of the profile, sorted by hotness: 45 46 ``` 47 % pprof -top [main_binary] profile.pb.gz 48 Where 49 main_binary: Local path to the main program binary, to enable symbolization 50 profile.pb.gz: Local path to the profile in a compressed protobuf, or 51 URL to the http service that serves a profile. 52 ``` 53 54 ## Generate a graph in an SVG file, and open it with a web browser: 55 56 ``` 57 pprof -web [main_binary] profile.pb.gz 58 ``` 59 60 ## Run pprof on interactive mode: 61 62 If no output formatting option is specified, pprof runs on interactive mode, 63 where reads the profile and accepts interactive commands for visualization and 64 refinement of the profile. 65 66 ``` 67 pprof [main_binary] profile.pb.gz 68 69 This will open a simple shell that takes pprof commands to generate reports. 70 Type 'help' for available commands/options. 71 ``` 72 73 ## Using pprof with Linux Perf 74 75 pprof can read `perf.data` files generated by the 76 [Linux perf](https://perf.wiki.kernel.org/index.php) tool by using the 77 `perf_to_profile` program from the 78 [perf_data_converter](http://github.com/google/perf_data_converter) package. 79 80 ## Further documentation 81 82 See [doc/pprof.md](doc/pprof.md) for more detailed end-user documentation. 83 84 See [doc/developer/pprof.dev.md](doc/developer/pprof.dev.md) for developer documentation. 85 86 See [doc/developer/profile.proto.md](doc/developer/profile.proto.md) for a description of the profile.proto format.