renderMarkdown static method

String renderMarkdown(
  1. PerformanceCertificationReport report
)

Render comprehensive Performance Certification Report as clean Markdown documentation.

Implementation

static String renderMarkdown(PerformanceCertificationReport report) {
  final buffer = StringBuffer();

  buffer.writeln(
      '# Milestone 11 — Phase 11.5: Performance Certification Report');
  buffer.writeln();
  buffer.writeln(
      '**Performance Certification Status:** `${report.isOverallCertified ? "CERTIFIED (Real Empirical Baselines)" : "FAILED"}`  ');
  buffer.writeln('**Target Release Version:** `v${report.targetVersion}`  ');
  buffer.writeln('**Certified At:** ${report.certifiedAt.toIso8601String()}');
  buffer.writeln();

  buffer.writeln('## Empirical Performance Baselines Matrix');
  buffer.writeln();
  buffer.writeln(
      '| Telemetry Metric | Low-End Tier | Normal Tier | High-End Tier | Target / SLA |');
  buffer.writeln('|---|:---:|:---:|:---:|:---:|');

  final low =
      report.profiles.firstWhere((p) => p.tier == HardwareProfileTier.lowEnd);
  final norm =
      report.profiles.firstWhere((p) => p.tier == HardwareProfileTier.normal);
  final high = report.profiles
      .firstWhere((p) => p.tier == HardwareProfileTier.highEnd);

  buffer.writeln(
      '| **FPS** | `${low.fps.toStringAsFixed(1)}` | `${norm.fps.toStringAsFixed(1)}` | `${high.fps.toStringAsFixed(1)}` | `>= 58.0 FPS` |');
  buffer.writeln(
      '| **Frame Time** | `${low.frameTimeMs}ms` | `${norm.frameTimeMs}ms` | `${high.frameTimeMs}ms` | `<= 16.6ms` |');
  buffer.writeln(
      '| **CPU Usage** | `${low.cpuUsagePercentage}%` | `${norm.cpuUsagePercentage}%` | `${high.cpuUsagePercentage}%` | `<= 20.0%` |');
  buffer.writeln(
      '| **GPU Workload** | `${low.gpuWorkloadPercentage}%` | `${norm.gpuWorkloadPercentage}%` | `${high.gpuWorkloadPercentage}%` | `<= 30.0%` |');
  buffer.writeln(
      '| **Memory Usage** | `${low.memoryUsageMb} MB` | `${norm.memoryUsageMb} MB` | `${high.memoryUsageMb} MB` | `<= 100 MB` |');
  buffer.writeln(
      '| **Allocation Rate** | `${low.allocationRateMbPerSec} MB/s` | `${norm.allocationRateMbPerSec} MB/s` | `${high.allocationRateMbPerSec} MB/s` | `<= 5.0 MB/s` |');
  buffer.writeln(
      '| **GC Pressure** | `${low.gcPressureEventsPerMin}/min` | `${norm.gcPressureEventsPerMin}/min` | `${high.gcPressureEventsPerMin}/min` | `<= 1.0/min` |');
  buffer.writeln(
      '| **Particle Count** | `${low.particleCount}` | `${norm.particleCount}` | `${high.particleCount}` | Scaled |');
  buffer.writeln(
      '| **Rendering Cost** | `${low.renderingCostMs}ms` | `${norm.renderingCostMs}ms` | `${high.renderingCostMs}ms` | `<= 8.0ms` |');
  buffer.writeln(
      '| **Startup Time** | `${low.startupTimeMs}ms` | `${norm.startupTimeMs}ms` | `${high.startupTimeMs}ms` | `<= 250ms` |');
  buffer.writeln();

  buffer.writeln('## Next Phase');
  buffer.writeln();
  buffer.writeln('**Phase 11.6 — Stress & Soak Testing**');
  buffer.writeln();

  return buffer.toString();
}