Browse files

[release-branch.go1.9] runtime: in cpuProfile.addExtra, set p.lostExt…

…ra 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-by: Austin Clements <>
Run-TryBot: Austin Clements <>
TryBot-Result: Gobot Gobot <>
(cherry picked from commit 96b1eff)
Run-TryBot: Ian Lance Taylor <>
  • Loading branch information...
matloob committed Sep 12, 2017
1 parent 0993369 commit 78a0a313a03d9d46d81cd4412f0ab647a98f4cbd
Showing with 1 addition and 0 deletions.
  1. +1 −0 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

0 comments on commit 78a0a31

Please sign in to comment.