Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. [![Build Status](https://travis-ci.org/google/pprof.svg?branch=master)](https://travis-ci.org/google/pprof)
  2. [![codecov](https://codecov.io/gh/google/pprof/graph/badge.svg)](https://codecov.io/gh/google/pprof)
  3. # Introduction
  4. pprof is a tool for visualization and analysis of profiling data.
  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. profile.proto is a protocol buffer that describes a set of callstacks
  9. and symbolization information. A common usage is to represent a set of
  10. sampled callstacks from statistical profiling. The format is
  11. described on the [proto/profile.proto](./proto/profile.proto) file. For details on protocol
  12. buffers, see https://developers.google.com/protocol-buffers
  13. Profiles can be read from a local file, or over http. Multiple
  14. profiles of the same type can be aggregated or compared.
  15. If the profile samples contain machine addresses, pprof can symbolize
  16. them through the use of the native binutils tools (addr2line and nm).
  17. **This is not an official Google product.**
  18. # Building pprof
  19. Prerequisites:
  20. - Go development kit of a [supported version](https://golang.org/doc/devel/release.html#policy).
  21. Follow [these instructions](http://golang.org/doc/code.html) to install the
  22. go tool and set up GOPATH.
  23. - Graphviz: http://www.graphviz.org/
  24. Optional, used to generate graphic visualizations of profiles
  25. To build and install it, use the `go get` tool.
  26. go get -u github.com/google/pprof
  27. Remember to set GOPATH to the directory where you want pprof to be
  28. installed. The binary will be in `$GOPATH/bin` and the sources under
  29. `$GOPATH/src/github.com/google/pprof`.
  30. # Basic usage
  31. pprof can read a profile from a file or directly from a server via http.
  32. Specify the profile input(s) in the command line, and use options to
  33. indicate how to format the report.
  34. ## Generate a text report of the profile, sorted by hotness:
  35. ```
  36. % pprof -top [main_binary] profile.pb.gz
  37. Where
  38. main_binary: Local path to the main program binary, to enable symbolization
  39. profile.pb.gz: Local path to the profile in a compressed protobuf, or
  40. URL to the http service that serves a profile.
  41. ```
  42. ## Generate a graph in an SVG file, and open it with a web browser:
  43. ```
  44. pprof -web [main_binary] profile.pb.gz
  45. ```
  46. ## Run pprof on interactive mode:
  47. If no output formatting option is specified, pprof runs on interactive mode,
  48. where reads the profile and accepts interactive commands for visualization and
  49. refinement of the profile.
  50. ```
  51. pprof [main_binary] profile.pb.gz
  52. This will open a simple shell that takes pprof commands to generate reports.
  53. Type 'help' for available commands/options.
  54. ```
  55. ## Run pprof via a web interface
  56. If the `-http` flag is specified, pprof starts a web server at
  57. the specified host:port that provides an interactive web-based interface to pprof.
  58. Host is optional, and is "localhost" by default. Port is optional, and is a
  59. random available port by default. `-http=":"` starts a server locally at
  60. a random port.
  61. ```
  62. pprof -http=[host]:[port] [main_binary] profile.pb.gz
  63. ```
  64. The preceding command should automatically open your web browser at
  65. the right page; if not, you can manually visit the specified port in
  66. your web browser.
  67. ## Using pprof with Linux Perf
  68. pprof can read `perf.data` files generated by the
  69. [Linux perf](https://perf.wiki.kernel.org/index.php/Main_Page) tool by using the
  70. `perf_to_profile` program from the
  71. [perf_data_converter](https://github.com/google/perf_data_converter) package.
  72. ## Further documentation
  73. See [doc/README.md](doc/README.md) for more detailed end-user documentation.
  74. See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution documentation.
  75. See [proto/README.md](proto/README.md) for a description of the profile.proto format.