github.com/loov/hrtime@v1.0.3/hrtesting/benchmark_go13.go (about) 1 // +build !nohrtime 2 // +build go1.13 3 4 package hrtesting 5 6 // Report reports the 50-th, 90-th and 99-th percentile as a metric. 7 func (bench *Benchmark) Report() { 8 hist := bench.hr.Histogram(1) 9 if bench.b.N >= 3 { 10 bench.b.ReportMetric(hist.P50, "ns/p50") 11 } 12 if bench.b.N >= 10 { 13 bench.b.ReportMetric(hist.P90, "ns/p90") 14 } 15 if bench.b.N >= 100 { 16 bench.b.ReportMetric(hist.P99, "ns/p99") 17 } 18 } 19 20 // Report reports the 50-th, 90-th and 99-th percentile as a metric. 21 func (bench *BenchmarkTSC) Report() { 22 hist := bench.hr.Histogram(1) 23 if bench.b.N >= 3 { 24 bench.b.ReportMetric(hist.P50, "tsc/p50") 25 } 26 if bench.b.N >= 10 { 27 bench.b.ReportMetric(hist.P90, "tsc/p90") 28 } 29 if bench.b.N >= 100 { 30 bench.b.ReportMetric(hist.P99, "tsc/p99") 31 } 32 }