package webui import ( "encoding/json" "fmt" "html" "os" "path/filepath" "sort" "strconv" "strings" "time" "bee/audit/internal/app" "bee/audit/internal/platform" ) type benchmarkHistoryRun struct { generatedAt time.Time displayTime string gpuScores map[int]float64 gpuStatuses map[int]string overallStatus string } func renderBenchmark(opts HandlerOptions) string { return `
Benchmark runs generate a human-readable TXT report and machine-readable result bundle. Tasks continue in the background — view progress in Tasks.
Loading NVIDIA GPUs...
Select one GPU for single-card benchmarking or several GPUs for a constrained multi-GPU run.
The benchmark page now exposes two fundamentally different test families so compute score and server power-fit are not mixed into one number.
| Run Type | Engine | Question | Standard | Stability |
|---|---|---|---|---|
| Performance Benchmark | bee-gpu-burn | How much isolated compute performance does the GPU realize in this server? | ` + validateFmtDur(platform.BenchmarkEstimatedPerfStandardSec) + ` | ` + validateFmtDur(platform.BenchmarkEstimatedPerfStabilitySec) + ` |
| Power / Thermal Fit | dcgmproftester + nvidia-smi -pl | How much power per GPU can this server sustain as GPU count ramps up? | ` + validateFmtDur(platform.BenchmarkEstimatedPowerStandardSec) + ` | ` + validateFmtDur(platform.BenchmarkEstimatedPowerStabilitySec) + ` |
Timings are per full ramp-up run (1 GPU → all selected), measured on 4–8 GPU servers. Use ramp-up mode for capacity work: it creates 1 GPU → 2 GPU → … → all selected steps so analysis software can derive server total score and watts-per-GPU curves.
` + html.EscapeString(emptyMessage) + `
` + html.EscapeString(description) + `
`) } b.WriteString(`| Run | Time | Status | `) for i := 0; i <= maxGPUIndex; i++ { b.WriteString(`GPU ` + strconv.Itoa(i) + ` | `) } b.WriteString(`|
|---|---|---|---|---|
| #` + strconv.Itoa(i+1) + ` | `) b.WriteString(`` + html.EscapeString(run.displayTime) + ` | `) overallColor := "var(--ok)" overallLabel := run.overallStatus if overallLabel == "" { overallLabel = "OK" } if overallLabel == "FAILED" { overallColor = "var(--crit-fg,#9f3a38)" } else if overallLabel != "OK" { overallColor = "var(--warn)" } b.WriteString(`` + html.EscapeString(overallLabel) + ` | `) for idx := 0; idx <= maxGPUIndex; idx++ { score, ok := run.gpuScores[idx] if !ok { b.WriteString(`- | `) continue } gpuStatus := run.gpuStatuses[idx] scoreColor := "" switch gpuStatus { case "FAILED": scoreColor = ` style="color:var(--crit-fg,#9f3a38);font-weight:600"` case "WARNING", "PARTIAL": scoreColor = ` style="color:var(--warn);font-weight:600"` case "", "OK": default: scoreColor = ` style="color:var(--warn);font-weight:600"` } b.WriteString(`` + fmt.Sprintf("%.2f", score) + ` | `) } b.WriteString(`
No saved power benchmark runs yet.
Latest run: ` + html.EscapeString(runs[0].displayTime)) if latest.Hostname != "" { b.WriteString(` — ` + html.EscapeString(latest.Hostname)) } if latest.OverallStatus != "" { statusColor := "var(--ok)" if latest.OverallStatus != "OK" { statusColor = "var(--warn)" } b.WriteString(` — ` + html.EscapeString(latest.OverallStatus) + ``) } b.WriteString(`
`) if len(latest.GPUs) > 0 { b.WriteString(`| GPU | Model | Nominal W | Single-card W | Multi-GPU W | P95 Observed W | Status | `) b.WriteString(`
|---|---|---|---|---|---|---|
| ` + strconv.Itoa(gpu.Index) + ` | `) b.WriteString(`` + html.EscapeString(gpu.Name) + ` | `) b.WriteString(`` + nominalStr + ` | `) b.WriteString(`` + singleStr + ` | `) b.WriteString(`` + multiStr + ` | `) b.WriteString(`` + p95Str + ` | `) b.WriteString(`` + html.EscapeString(statusLabel) + ` | `) b.WriteString(`
| # | Time | GPUs | Status |
|---|---|---|---|
| #` + strconv.Itoa(i+1) + ` | `) b.WriteString(`` + html.EscapeString(run.displayTime) + ` | `) b.WriteString(`` + strconv.Itoa(len(run.result.GPUs)) + ` | `) b.WriteString(`` + html.EscapeString(run.result.OverallStatus) + ` | `) b.WriteString(`