From: Michael Matloob Date: Tue, 12 Sep 2017 16:22:22 +0000 (-0400) Subject: runtime: in cpuProfile.addExtra, set p.lostExtra to 0 after flush X-Git-Tag: go1.10beta1~1128 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=96b1eff087bd29c43d60b27aad6e53c2ca7e67c7;p=gostls13.git runtime: in cpuProfile.addExtra, set p.lostExtra to 0 after flush After the number of lost extra events are written to the the cpuprof log, the number of lost extra events should be set to zero, or else, the next time time addExtra is logged, lostExtra will be overcounted. This change resets lostExtra after its value is written to the log. Fixes #21836 Change-Id: I8a6ac9c61e579e7a5ca7bdb0f3463f8ae8b9f863 Reviewed-on: https://go-review.googlesource.com/63270 Reviewed-by: Austin Clements Run-TryBot: Austin Clements TryBot-Result: Gobot Gobot --- diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go index fb841a9f3d..e00dcb1bbd 100644 --- a/src/runtime/cpuprof.go +++ b/src/runtime/cpuprof.go @@ -160,6 +160,7 @@ func (p *cpuProfile) addExtra() { funcPC(_ExternalCode) + sys.PCQuantum, } cpuprof.log.write(nil, 0, hdr[:], lostStk[:]) + p.lostExtra = 0 } }