Source File
histogram.go
Belonging Package
runtime
package runtime
import (
)
type timeHistogram struct {
counts [timeHistNumSuperBuckets * timeHistNumSubBuckets]uint64
func ( *timeHistogram) ( int64) {
if < 0 {
atomic.Xadd64(&.underflow, 1)
return
var , uint
= uint(sys.Len64(uint64())) - timeHistSubBucketBits
= timeHistNumSuperBuckets - 1
= timeHistNumSubBuckets - 1
= uint(( >> ( - 1)) % timeHistNumSubBuckets)
}
} else {
= uint()
}
atomic.Xadd64(&.counts[*timeHistNumSubBuckets+], 1)
}
const (
fInf = 0x7FF0000000000000
fNegInf = 0xFFF0000000000000
)
func () float64 {
:= uint64(fInf)
return *(*float64)(unsafe.Pointer(&))
}
func () float64 {
:= uint64(fNegInf)
return *(*float64)(unsafe.Pointer(&))
}
func () []float64 {
:= make([]float64, timeHistTotalBuckets+1)
[0] = float64NegInf()
for := 0; < timeHistNumSuperBuckets; ++ {
= uint64(1) << uint(-1+timeHistSubBucketBits)
:= uint(0)
= uint( - 2)
}
:= + (uint64() << )
[*timeHistNumSubBuckets++1] = float64() / 1e9
}
}
[len()-1] = float64Inf()
return
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |