1
0
mirror of https://github.com/golang/go synced 2024-11-17 00:04:40 -07:00

cmd/trace: display goroutines (PC=0) with clearer description

This PR fixes: #54425 #49994

Change-Id: Id60a3ba6930f8e29b12b6d8f80945decd2ce31bc
GitHub-Last-Rev: 60a040aa2f
GitHub-Pull-Request: golang/go#54575
Reviewed-on: https://go-review.googlesource.com/c/go/+/425042
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
hitzhangjie 2022-08-25 09:34:49 +00:00 committed by Michael Pratt
parent 56bdf7f7d9
commit 04eb35998a

View File

@ -64,6 +64,11 @@ func httpGoroutines(w http.ResponseWriter, r *http.Request) {
var glist []gtype
for k, v := range gss {
v.ID = k
// If goroutine didn't run during the trace (no sampled PC),
// the v.ID and v.Name will be zero value.
if v.ID == 0 && v.Name == "" {
v.Name = "(Inactive, no stack trace sampled)"
}
glist = append(glist, v)
}
sort.Slice(glist, func(i, j int) bool { return glist[i].ExecTime > glist[j].ExecTime })