(targetName, samples)
| 275 | } |
| 276 | |
| 277 | function printSummary(targetName, samples) { |
| 278 | const names = metricNames[targetName] |
| 279 | const failures = [] |
| 280 | console.log(`\nZenNotes ${targetName} runtime repeat summary`) |
| 281 | console.log(`runs ${String(samples.length).padStart(8)}`) |
| 282 | console.log('metric p50 p95 max min') |
| 283 | for (const name of names) { |
| 284 | const values = metricValues(samples, name) |
| 285 | if (values.length === 0) continue |
| 286 | const p50 = round(percentile(values, 50)) |
| 287 | const p95 = round(percentile(values, 95)) |
| 288 | const max = round(Math.max(...values)) |
| 289 | const min = round(Math.min(...values)) |
| 290 | console.log( |
| 291 | `${name.padEnd(32)} ${String(p50).padStart(8)} ${String(p95).padStart(9)} ${String(max).padStart(9)} ${String(min).padStart(9)}` |
| 292 | ) |
| 293 | } |
| 294 | for (const { label, budget } of repeatBudgets[targetName]) { |
| 295 | const values = metricValues(samples, label) |
| 296 | if (values.length === 0) { |
| 297 | failures.push({ label, actual: 'missing', budget }) |
| 298 | continue |
| 299 | } |
| 300 | const p95 = round(percentile(values, 95)) |
| 301 | if (p95 > budget) failures.push({ label, actual: p95, budget }) |
| 302 | } |
| 303 | if (failures.length > 0) { |
| 304 | console.log('\nRepeat budget warnings') |
| 305 | for (const failure of failures) { |
| 306 | console.log(`- ${failure.label}: p95 ${failure.actual} > ${failure.budget}`) |
| 307 | } |
| 308 | } |
| 309 | return failures |
| 310 | } |
| 311 | |
| 312 | const allFailures = [] |
| 313 | for (const targetName of targets) { |
no test coverage detected