]> Cypherpunks repositories - gostls13.git/commit
runtime: speed up StartTrace with lots of blocked goroutines
authorDmitry Vyukov <dvyukov@google.com>
Mon, 8 Aug 2016 14:02:09 +0000 (16:02 +0200)
committerDmitry Vyukov <dvyukov@google.com>
Mon, 22 Aug 2016 17:40:10 +0000 (17:40 +0000)
commit747a158ef314bb458b90da95f3e3d67aa4140622
tree8382246510bcf50c4147faddb46f7f2e1e4e5751
parent7c5f33b173d7bde6b3ae33bab940b76b4c991556
runtime: speed up StartTrace with lots of blocked goroutines

In StartTrace we emit EvGoCreate for all existing goroutines.
This includes stack unwind to obtain current stack.
Real Go programs can contain hundreds of thousands of blocked goroutines.
For such programs StartTrace can take up to a second (few ms per goroutine).

Obtain current stack ID once and use it for all EvGoCreate events.

This speeds up StartTrace with 10K blocked goroutines from 20ms to 4 ms
(win for StartTrace called from net/http/pprof hander will be bigger
as stack is deeper).

Change-Id: I9e5ff9468331a840f8fdcdd56c5018c2cfde61fc
Reviewed-on: https://go-review.googlesource.com/25573
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
src/runtime/trace.go