]> Cypherpunks repositories - gostls13.git/commit
cmd/trace: fix a runnable goroutine count bug
authorHyang-Ah (Hana) Kim <hyangah@gmail.com>
Mon, 8 Aug 2016 21:24:07 +0000 (17:24 -0400)
committerHyang-Ah Hana Kim <hyangah@gmail.com>
Tue, 11 Oct 2016 12:07:44 +0000 (12:07 +0000)
commitc24cc40075d77b96bbf1f217dcdcff651229e89b
tree7d17e92f58a4cde5e4405cfaf4f92290413442df
parentdd307da10c3582c195928d9bf073d1b0b01f2135
cmd/trace: fix a runnable goroutine count bug

When starting tracing, EvGoCreate events are added for existing
goroutines that may have been blocking in syscall. EvGoCreate
increments the runnable goroutine count. This change makes the
following EvGoInSyscall event decrement the runnable goroutine count
because we now know that goroutine is in syscall, and not runnable.

Made generateTrace return an error, at any given time, the number
of runnable/running/insyscall goroutines becomes non-negative.

Added a basic test that checks the number of runnable/running
goroutines don't include the goroutines in syscall - the test failed
before this change.

Change-Id: Ib732c382e7bd17158a437576f9d589ab89097ce6
Reviewed-on: https://go-review.googlesource.com/25552
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
src/cmd/trace/main.go
src/cmd/trace/trace.go
src/cmd/trace/trace_test.go [new file with mode: 0644]
src/internal/trace/parser_test.go
src/internal/trace/writer.go [new file with mode: 0644]