Update PROFILING.md

This commit is contained in:
Neil Alexander 2020-12-03 13:49:34 +00:00
parent 253b05ccde
commit 52905ffb82
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -31,6 +31,8 @@ http://localhost:65432/debug/pprof/profile?seconds=30
The profile will run for the specified number of `seconds` and then will produce a result. The profile will run for the specified number of `seconds` and then will produce a result.
### Examine a profile using the Go toolchain
If you have Go installed and want to explore the profile, you can invoke `go tool pprof` to start the profile directly. The `-http=` parameter will instruct `go tool pprof` to start a web server providing a view of the captured profile: If you have Go installed and want to explore the profile, you can invoke `go tool pprof` to start the profile directly. The `-http=` parameter will instruct `go tool pprof` to start a web server providing a view of the captured profile:
``` ```
@ -39,6 +41,8 @@ go tool pprof -http=localhost:23456 http://localhost:65432/debug/pprof/profile?s
You can then visit `http://localhost:23456` in your web browser to see a visual representation of the profile. Particularly usefully, in the "View" menu, you can select "Flame Graph" to see a proportional interactive graph of CPU usage. You can then visit `http://localhost:23456` in your web browser to see a visual representation of the profile. Particularly usefully, in the "View" menu, you can select "Flame Graph" to see a proportional interactive graph of CPU usage.
### Download a profile to send to someone else
If you don't have the Go tools installed but just want to capture the profile to send to someone else, you can instead use `curl` to download the profiler results: If you don't have the Go tools installed but just want to capture the profile to send to someone else, you can instead use `curl` to download the profiler results:
``` ```
@ -57,6 +61,8 @@ http://localhost:65432/debug/pprof/heap
The profile will return almost instantly. The profile will return almost instantly.
### Examine a profile using the Go toolchain
If you have Go installed and want to explore the profile, you can invoke `go tool pprof` to start the profile directly. The `-http=` parameter will instruct `go tool pprof` to start a web server providing a view of the captured profile: If you have Go installed and want to explore the profile, you can invoke `go tool pprof` to start the profile directly. The `-http=` parameter will instruct `go tool pprof` to start a web server providing a view of the captured profile:
``` ```
@ -72,6 +78,8 @@ You can then visit `http://localhost:23456` in your web browser to see a visual
Also in the "View" menu, you can select "Flame Graph" to see a proportional interactive graph of the memory usage. Also in the "View" menu, you can select "Flame Graph" to see a proportional interactive graph of the memory usage.
### Download a profile to send to someone else
If you don't have the Go tools installed but just want to capture the profile to send to someone else, you can instead use `curl` to download the profiler results: If you don't have the Go tools installed but just want to capture the profile to send to someone else, you can instead use `curl` to download the profiler results:
``` ```