golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.41k stars 17.71k forks source link

runtime: improve goroutine profiler #7926

Open dvyukov opened 10 years ago

dvyukov commented 10 years ago
Some concrete suggestions:
1. Add goroutine state (waiting, runnable, syscall) as comment in debug more and/or as
top frame (so that all waiting goroutines converge in a single "Waiting" block
in svg graph.
2. Add "created by" line in debug mode.
3. Dedup stacks, there can be thousands of equal stacks.
dvyukov commented 10 years ago

Comment 1:

Another useful piece of information is how long a goroutine is blocked (similar to what
we output in crash reports). But this conflicts with stack deduplication.
hyangah commented 10 years ago

Comment 2:

which debug mode do you target? Do you target to add additional display debug mode?
* debug=1 doesn't show each goroutine state or created-by info, but collapses the equal
stacks into a group.
* debug=2 shows each goroutine's state and created-by info along with function arguments.
dvyukov commented 10 years ago

Comment 3:

You are right, I've missed debug=2 mode.
So the only potential addition is 1.
I wanted to check how it would look like, but it turned out that pprof does not support
goroutine profiles. That's something to fix.
rsc commented 10 years ago

Comment 4:

Labels changed: added release-none, removed release-go1.4.