in Sources/_TracingBenchmarkTools/DriverUtils.swift [664:704]
func runBenchmarks() {
var testCount = 0
func report(_ index: String, _ t: BenchmarkInfo, results: BenchResults?) {
func values(r: BenchResults) -> [String] {
func quantiles(q: Int) -> [Int] {
let qs = (0 ... q).map { i in r[Double(i) / Double(q)] }
return c.delta ?
qs.reduce(into: (encoded: [], last: 0)) {
$0.encoded.append($1 - $0.last); $0.last = $1
}.encoded : qs
}
return (
[r.sampleCount] +
(
c.quantile.map(quantiles)
?? [r.min, r.max, r.mean, r.sd, r.median]
) +
[r.maxRSS].compactMap { $0 }
).map { (c.delta && $0 == 0) ? "" : String($0) } // drop 0s in deltas
}
let benchmarkStats = (
[index, t.name] + (results.map(values) ?? ["Unsupported"])
).joined(separator: c.delim)
print(benchmarkStats)
fflush(stdout)
if results != nil {
testCount += 1
}
}
print(header)
for (index, test) in c.tests {
report(index, test, results: run(test))
}
print("\nTotal performance tests executed: \(testCount)")
}