evaluate static method
Evaluates report against budget.
report.sceneId and budget.sceneId must match -- callers look a
budget up by the report's own scene id (see BenchmarkBudgets), so a
mismatch here means the caller wired the wrong pair together, which is
a bug worth an assertion rather than a silently wrong comparison.
Implementation
static BenchmarkGateResult evaluate(
BenchmarkFrameReport report,
SceneBudget budget,
) {
assert(
report.sceneId == budget.sceneId,
'evaluate() was given a report for "${report.sceneId}" and a budget '
'for "${budget.sceneId}" -- these must be the same scene.',
);
if (!report.runMode.isTrustworthy) {
return BenchmarkGateResult(
sceneId: report.sceneId,
violations: const <BudgetViolation>[],
skippedUntrustworthy: true,
);
}
final violations = <BudgetViolation>[];
void check(String metric, double actualMs, double budgetMs) {
if (actualMs > budgetMs) {
violations.add(
BudgetViolation(
metric: metric,
actualMs: actualMs,
budgetMs: budgetMs,
),
);
}
}
check(
'raster p90',
report.raster.p90.inMicroseconds / 1000,
budget.rasterP90Ms,
);
check(
'raster p99',
report.raster.p99.inMicroseconds / 1000,
budget.rasterP99Ms,
);
check(
'build p90',
report.build.p90.inMicroseconds / 1000,
budget.buildP90Ms,
);
return BenchmarkGateResult(
sceneId: report.sceneId,
violations: violations,
skippedUntrustworthy: false,
);
}