INNER CODE UNIT · Go
init
bhope/hedge · benchmark/simulate/main.go:35
func init() {
const meanNs = baseMeanMs * 1e6
const stddevNs = baseStddevMs * 1e6
cv2 := (stddevNs / meanNs) * (stddevNs / meanNs)
sigmaLn = math.Sqrt(math.Log(1 + cv2))
muLn = math.Log(meanNs) - sigmaLn*sigmaLn/2
}
func sampleLatency() time.Duration {
base := time.Duration(math.Exp(muLn + sigmaLn*rand.NormFloat64()))
if rand.Float64() < stragglerP {
return time.Duration(float64(base) * stragglerMul)
}
return base
}
type simResult struct {
latencies []time.Duration