@@ -222,8 +222,8 @@ func (r *Reporter) Finalize(stopReason StopReason, total time.Duration) *Report
222
222
223
223
rep .Fastest = time .Duration (fastestNum * float64 (time .Second ))
224
224
rep .Slowest = time .Duration (slowestNum * float64 (time .Second ))
225
- rep .Histogram = histogram (& lats , slowestNum , fastestNum )
226
- rep .LatencyDistribution = latencies (& lats )
225
+ rep .Histogram = histogram (lats , slowestNum , fastestNum )
226
+ rep .LatencyDistribution = latencies (lats )
227
227
228
228
rep .Details = make ([]ResultDetail , len (r .lats ))
229
229
for i , num := range r .lats {
@@ -240,15 +240,14 @@ func (r *Reporter) Finalize(stopReason StopReason, total time.Duration) *Report
240
240
return rep
241
241
}
242
242
243
- func latencies (latencies * []float64 ) []LatencyDistribution {
244
- lats := * latencies
243
+ func latencies (latencies []float64 ) []LatencyDistribution {
245
244
pctls := []int {10 , 25 , 50 , 75 , 90 , 95 , 99 }
246
245
data := make ([]float64 , len (pctls ))
247
246
j := 0
248
- for i := 0 ; i < len (lats ) && j < len (pctls ); i ++ {
249
- current := i * 100 / len (lats )
247
+ for i := 0 ; i < len (latencies ) && j < len (pctls ); i ++ {
248
+ current := i * 100 / len (latencies )
250
249
if current >= pctls [j ] {
251
- data [j ] = lats [i ]
250
+ data [j ] = latencies [i ]
252
251
j ++
253
252
}
254
253
}
@@ -262,8 +261,7 @@ func latencies(latencies *[]float64) []LatencyDistribution {
262
261
return res
263
262
}
264
263
265
- func histogram (latencies * []float64 , slowest , fastest float64 ) []Bucket {
266
- lats := * latencies
264
+ func histogram (latencies []float64 , slowest , fastest float64 ) []Bucket {
267
265
bc := 10
268
266
buckets := make ([]float64 , bc + 1 )
269
267
counts := make ([]int , bc + 1 )
@@ -274,8 +272,8 @@ func histogram(latencies *[]float64, slowest, fastest float64) []Bucket {
274
272
buckets [bc ] = slowest
275
273
var bi int
276
274
var max int
277
- for i := 0 ; i < len (lats ); {
278
- if lats [i ] <= buckets [bi ] {
275
+ for i := 0 ; i < len (latencies ); {
276
+ if latencies [i ] <= buckets [bi ] {
279
277
i ++
280
278
counts [bi ]++
281
279
if max < counts [bi ] {
@@ -290,7 +288,7 @@ func histogram(latencies *[]float64, slowest, fastest float64) []Bucket {
290
288
res [i ] = Bucket {
291
289
Mark : buckets [i ],
292
290
Count : counts [i ],
293
- Frequency : float64 (counts [i ]) / float64 (len (lats )),
291
+ Frequency : float64 (counts [i ]) / float64 (len (latencies )),
294
292
}
295
293
}
296
294
return res
0 commit comments