mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
09cc9bac72
commit
b04e4637db
7 changed files with 11 additions and 29 deletions
|
|
@ -7,7 +7,6 @@ package runtime
|
|||
// Metrics implementation exported to runtime/metrics.
|
||||
|
||||
import (
|
||||
"runtime/internal/atomic"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
|
|
@ -197,9 +196,9 @@ func initMetrics() {
|
|||
// The bottom-most bucket, containing negative values, is tracked
|
||||
// as a separately as underflow, so fill that in manually and then
|
||||
// iterate over the rest.
|
||||
hist.counts[0] = atomic.Load64(&memstats.gcPauseDist.underflow)
|
||||
hist.counts[0] = memstats.gcPauseDist.underflow.Load()
|
||||
for i := range memstats.gcPauseDist.counts {
|
||||
hist.counts[i+1] = atomic.Load64(&memstats.gcPauseDist.counts[i])
|
||||
hist.counts[i+1] = memstats.gcPauseDist.counts[i].Load()
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
@ -327,9 +326,9 @@ func initMetrics() {
|
|||
"/sched/latencies:seconds": {
|
||||
compute: func(_ *statAggregate, out *metricValue) {
|
||||
hist := out.float64HistOrInit(timeHistBuckets)
|
||||
hist.counts[0] = atomic.Load64(&sched.timeToRun.underflow)
|
||||
hist.counts[0] = sched.timeToRun.underflow.Load()
|
||||
for i := range sched.timeToRun.counts {
|
||||
hist.counts[i+1] = atomic.Load64(&sched.timeToRun.counts[i])
|
||||
hist.counts[i+1] = sched.timeToRun.counts[i].Load()
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue