]> Cypherpunks repositories - gostls13.git/commit
cmd/trace: fix goroutine view
authorAustin Clements <austin@google.com>
Fri, 4 Nov 2016 15:13:27 +0000 (11:13 -0400)
committerAustin Clements <austin@google.com>
Fri, 18 Nov 2016 17:49:18 +0000 (17:49 +0000)
commitd0b3c169acda68040d051c27627c08da4e3377bd
tree18eab35bf96cd57f38279bfdc90174abdf36d1ba
parent0eb26fa8ba531b21d183fd3a4d3fb8abf57db7aa
cmd/trace: fix goroutine view

Currently, trace processing interleaves state/statistics updates and
emitting trace viewer objects. As a result, if events are being
filtered, either by time or by goroutines, we'll miss those
state/statistics updates. At best, this leads to bad statistics;
however, since we're now strictly checking G state transitions, it
usually leads to a failure to process the trace if there is any
filtering.

Fix this by separating state updates from emitting trace object. State
updates are done before filtering, so we always have correct state
information and statistics. Trace objects are only emitted if we pass
the filter. To determine when we need to emit trace counters, rather
than duplicating the knowledge of which events might modify
statistics, we keep track of the previously emitted counters and emit
a trace counter object whenever these have changed.

Fixes #17719.

Change-Id: Ic66e3ddaef60d1acaaf2ff4c62baa5352799cf99
Reviewed-on: https://go-review.googlesource.com/32810
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
src/cmd/trace/trace.go
src/cmd/trace/trace_test.go