Updates #53821
Change-Id: Ia0c58d7e7e11a1b52bbb7c19ebbb131e3eea5314
Reviewed-on: https://go-review.googlesource.com/c/go/+/424926
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
unsafe.Offsetof(lfnode{}.next),
unsafe.Offsetof(mstats{}.last_gc_nanotime),
unsafe.Offsetof(mstats{}.last_gc_unix),
- unsafe.Offsetof(ticksType{}.val),
unsafe.Offsetof(workType{}.bytesMarked),
}
type ticksType struct {
lock mutex
- pad uint32 // ensure 8-byte alignment of val on 386
- val uint64
+ val atomic.Int64
}
// Note: Called by runtime/pprof in addition to runtime code.
func tickspersecond() int64 {
- r := int64(atomic.Load64(&ticks.val))
+ r := ticks.val.Load()
if r != 0 {
return r
}
lock(&ticks.lock)
- r = int64(ticks.val)
+ r = ticks.val.Load()
if r == 0 {
t0 := nanotime()
c0 := cputicks()
if r == 0 {
r++
}
- atomic.Store64(&ticks.val, uint64(r))
+ ticks.val.Store(r)
}
unlock(&ticks.lock)
return r