diff options
| author | Austin Clements <austin@google.com> | 2016-10-08 18:38:35 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2016-10-28 14:29:47 +0000 |
| commit | 6da83c6fc006019f6fe0503099d165e19f465b1b (patch) | |
| tree | 155fe589bc74911e73cd403ca40a9254af2feb81 /src/internal/trace/parser.go | |
| parent | 640e9169155ea96a6f1156663269dba5babf0632 (diff) | |
| download | go-6da83c6fc006019f6fe0503099d165e19f465b1b.tar.xz | |
runtime, cmd/trace: track goroutines blocked on GC assists
Currently when a goroutine blocks on a GC assist, it emits a generic
EvGoBlock event. Since assist blocking events and, in particular, the
length of the blocked assist queue, are important for diagnosing GC
behavior, this commit adds a new EvGoBlockGC event for blocking on a
GC assist. The trace viewer uses this event to report a "waiting on
GC" count in the "Goroutines" row. This makes sense because, unlike
other blocked goroutines, these goroutines do have work to do, so
being blocked on a GC assist is quite similar to being in the
"runnable" state, which we also report in the trace viewer.
Change-Id: Ic21a326992606b121ea3d3d00110d8d1fdc7a5ef
Reviewed-on: https://go-review.googlesource.com/30704
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Diffstat (limited to 'src/internal/trace/parser.go')
| -rw-r--r-- | src/internal/trace/parser.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/internal/trace/parser.go b/src/internal/trace/parser.go index 3110d6341f..4017623749 100644 --- a/src/internal/trace/parser.go +++ b/src/internal/trace/parser.go @@ -375,7 +375,7 @@ func parseEvents(ver int, rawEvents []rawEvent, strings map[uint64]string) (even case EvGoEnd, EvGoStop, EvGoSched, EvGoPreempt, EvGoSleep, EvGoBlock, EvGoBlockSend, EvGoBlockRecv, EvGoBlockSelect, EvGoBlockSync, EvGoBlockCond, EvGoBlockNet, - EvGoSysBlock: + EvGoSysBlock, EvGoBlockGC: lastG = 0 case EvGoSysExit, EvGoWaiting, EvGoInSyscall: e.G = e.Args[0] @@ -687,7 +687,7 @@ func postProcessTrace(ver int, events []*Event) error { g.state = gRunnable g.ev = ev case EvGoSleep, EvGoBlock, EvGoBlockSend, EvGoBlockRecv, - EvGoBlockSelect, EvGoBlockSync, EvGoBlockCond, EvGoBlockNet: + EvGoBlockSelect, EvGoBlockSync, EvGoBlockCond, EvGoBlockNet, EvGoBlockGC: if err := checkRunning(p, g, ev, false); err != nil { return err } @@ -895,7 +895,8 @@ const ( EvGoUnblockLocal = 39 // goroutine is unblocked on the same P as the last event [timestamp, goroutine id, stack] EvGoSysExitLocal = 40 // syscall exit on the same P as the last event [timestamp, goroutine id, real timestamp] EvGoStartLabel = 41 // goroutine starts running with label [timestamp, goroutine id, seq, label string id] - EvCount = 42 + EvGoBlockGC = 42 // goroutine blocks on GC assist [timestamp, stack] + EvCount = 43 ) var EventDescriptions = [EvCount]struct { @@ -946,4 +947,5 @@ var EventDescriptions = [EvCount]struct { EvGoUnblockLocal: {"GoUnblockLocal", 1007, true, []string{"g"}}, EvGoSysExitLocal: {"GoSysExitLocal", 1007, false, []string{"g", "ts"}}, EvGoStartLabel: {"GoStartLabel", 1008, false, []string{"g", "seq", "label"}}, + EvGoBlockGC: {"GoBlockGC", 1008, true, []string{}}, } |
