Documentation ¶
Index ¶
- Constants
- func Abs(n int64) int64
- func Clamp[T constraints.Ordered](n, min, max T) T
- func IsFinite(f float64) bool
- func Max[T constraints.Ordered](x T, xs ...T) T
- func Min[T constraints.Ordered](x T, xs ...T) T
- func StrLenOfInt64Fast(x int64) int
- func StrLenOfUint64Fast(x uint64) int
- type ExponentialMovingAverage
- type MysqlRng
Constants ¶
const ( MaxInt = 1<<(IntBits-1) - 1 MinInt = -MaxInt - 1 MaxUint = 1<<IntBits - 1 IntBits = 1 << (^uint(0)>>32&1 + ^uint(0)>>16&1 + ^uint(0)>>8&1 + 3) )
Architecture and/or implementation specific integer limits and bit widths.
Variables ¶
This section is empty.
Functions ¶
func Abs ¶
Abs implement the abs function according to http://cavaliercoder.com/blog/optimized-abs-for-int64-in-go.html
func Clamp ¶
func Clamp[T constraints.Ordered](n, min, max T) T
Clamp restrict a value to a certain interval.
func Max ¶
func Max[T constraints.Ordered](x T, xs ...T) T
Max returns the largest one from its arguments.
func Min ¶
func Min[T constraints.Ordered](x T, xs ...T) T
Min returns the smallest one from its arguments.
func StrLenOfInt64Fast ¶
StrLenOfInt64Fast efficiently calculate the string character lengths of an int64 as input
func StrLenOfUint64Fast ¶
StrLenOfUint64Fast efficiently calculate the string character lengths of an uint64 as input
Types ¶
type ExponentialMovingAverage ¶
type ExponentialMovingAverage struct {
// contains filtered or unexported fields
}
ExponentialMovingAverage is an exponential moving average measurement implementation. It is not thread-safe.
func NewExponentialMovingAverage ¶
func NewExponentialMovingAverage( factor float64, warmupWindow int, ) *ExponentialMovingAverage
NewExponentialMovingAverage will create a new ExponentialMovingAverage.
func (*ExponentialMovingAverage) Add ¶
func (m *ExponentialMovingAverage) Add(value float64)
Add a single sample and update the internal state.
func (*ExponentialMovingAverage) Get ¶
func (m *ExponentialMovingAverage) Get() float64
Get the current value.
type MysqlRng ¶
type MysqlRng struct {
// contains filtered or unexported fields
}
MysqlRng is random number generator and this implementation is ported from MySQL. See https://github.com/tikv/tikv/pull/6117#issuecomment-562489078.
func NewWithSeed ¶
NewWithSeed create a rng with random seed.
func (*MysqlRng) GetSeed1 ¶
GetSeed1 is an interface to get seed1. It's only used for getting session states.
func (*MysqlRng) GetSeed2 ¶
GetSeed2 is an interface to get seed2. It's only used for getting session states.