]> Cypherpunks repositories - gostls13.git/commit
runtime: make STW duration more accurate
authorAustin Clements <austin@google.com>
Mon, 24 Jul 2017 20:06:10 +0000 (16:06 -0400)
committerAustin Clements <austin@google.com>
Tue, 15 Aug 2017 18:47:08 +0000 (18:47 +0000)
commit250a9610a41aa0fec6f020d2c31efe8fcd1f2941
tree4f50bfdb7e4b0fe75a5f51a64f010de589ba1626
parentd47c9bce812dbbb2d2dde04054875ed5402c10e3
runtime: make STW duration more accurate

Currently, GC captures the start-the-world time stamp after
startTheWorldWithSema returns. This is problematic for two reasons:

1. It's possible to get preempted between startTheWorldWithSema
starting the world and calling nanotime.

2. startTheWorldWithSema does several clean-up tasks after the world
is up and running that on rare occasions can take upwards of 10ms.

Since the runtime uses the start-the-world time stamp to compute the
STW duration, both of these can significantly inflate the reported STW
duration.

Fix this by having startTheWorldWithSema itself call nanotime once the
world is started.

Change-Id: I114630234fb73c9dabae50a2ef1884661f2459db
Reviewed-on: https://go-review.googlesource.com/55410
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/mgc.go
src/runtime/proc.go