Skip to content

Commit

Permalink
cmd/trace/v2: make the -pprof actually useful
Browse files Browse the repository at this point in the history
In both the v1 and v2 cmd/trace, pprofMatchingGoroutines will generate
no output at all if the filter name passed to it is the empty string.

This is rather pointless because there are at least two places where we
don't pass a name to filter. Modify pprofMatchingGoroutines to include
*all* goroutines in the trace if the name to filter by is not specified.

For #66782.

Change-Id: I6b72298d676bc93892b075a7426e6e56bc6656c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/578356
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
Auto-Submit: Michael Knyszek <[email protected]>
  • Loading branch information
mknyszek authored and gopherbot committed Apr 11, 2024
1 parent e14aad1 commit d1f2cd8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmd/trace/v2/pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func pprofByRegion(compute computePprofFunc, t *parsedTrace) traceviewer.Profile
func pprofMatchingGoroutines(name string, t *parsedTrace) (map[tracev2.GoID][]interval, error) {
res := make(map[tracev2.GoID][]interval)
for _, g := range t.summary.Goroutines {
if g.Name != name {
if name != "" && g.Name != name {
continue
}
endTime := g.EndTime
Expand Down

0 comments on commit d1f2cd8

Please sign in to comment.