INNER CODE UNIT · Go

idx

bhope/hedge · benchmark/simulate/main.go:92

	idx := int(float64(len(sorted)-1) * p)
	return sorted[idx]
}

func fmtDur(d time.Duration) string {
	return fmt.Sprintf("%.1fms", float64(d)/float64(time.Millisecond))
}

func main() {
	var serverHits atomic.Int64

	srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		serverHits.Add(1)
		d := sampleLatency()
		select {
		case <-time.After(d):
			w.WriteHeader(http.StatusOK)
		case <-r.Context().Done():

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…