Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: runtime/pprof documentation needs clarification #29444

Open
afiskon opened this issue Dec 28, 2018 · 4 comments

Comments

@afiskon
Copy link

commented Dec 28, 2018

The documentation is not clear regarding what exactly pprof shows. Here are a few examples.

go tool pprof -http=":8081" http://localhost:8080/debug/pprof/profile?seconds=30

Let's open the flamegraph. There are at least two possibilities:

  1. The flamegraph shows the clock time spent with given stacktrace
  2. The flamegraph shows on-CPU time spent with given stacktrace, i.e. clock time excluding the time spent waiting for disk/network I/O or execution of other programs.

Since I/O can be quite slow these are very different options. Both reports are useful depending on what bottleneck we are trying to fix (I/O or CPU).

go tool pprof -http=":8081" http://localhost:8080/debug/pprof/heap

I'm assuming the flamegraph shows places where given amount of memory was allocated. However it's not clear whether this is 1) the total amount of allocated memory (i.e. it doesn't matter if it was freed), 2) amount of allocated memory of objects that are currently alive, or 3) amount of memory of objects that are not garbage collected yet. Without proper documentation there is no way to tell which option, if any, is correct.

go tool pprof -http=":8081" http://localhost:8080/debug/pprof/block

The time shown doesn't make much sense. On the flamegraph I see something like 18988816179 usec i.e. 5 hours. However the program was executing only for a few minutes. I guess the time should be divided by the number of CPUs or maybe by the number of goroutines (what if it varies?).

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Dec 28, 2018

Which documentation are you looking at?

@afiskon

This comment has been minimized.

@agnivade

This comment has been minimized.

Copy link
Member

commented Jan 7, 2019

/cc @hyangah

@hyangah

This comment has been minimized.

Copy link
Contributor

commented Jan 7, 2019

For memory, see the documentation in https://golang.org/pkg/runtime/pprof/#Profile

pprof still offers -inuse_space, -inuse_objects, -alloc_space, and -alloc_objects flags for Go's memory profiles.

CPU profile is SIGPROF-based measurement (see man setitimer, ITIMER_PROF) of active CPU cycles.
I agree these need to be clear from the runtime/pprof package doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.