runtime: convert timeHistogram to atomic types

I've dropped the note that sched.timeToRun is protected by sched.lock,
as it does not seem to be true.

For #53821.

Change-Id: I03f8dc6ca0bcd4ccf3ec113010a0aa39c6f7d6ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/419449
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
This commit is contained in:
Michael Pratt 2022-07-25 15:58:23 -04:00
parent 09cc9bac72
commit b04e4637db
7 changed files with 11 additions and 29 deletions

View file

@ -1244,9 +1244,9 @@ func (th *TimeHistogram) Count(bucket, subBucket uint) (uint64, bool) {
t := (*timeHistogram)(th)
i := bucket*TimeHistNumSubBuckets + subBucket
if i >= uint(len(t.counts)) {
return t.underflow, false
return t.underflow.Load(), false
}
return t.counts[i], true
return t.counts[i].Load(), true
}
func (th *TimeHistogram) Record(duration int64) {