import type { ResourceStats } from "@/lib/db/schema"; import { formatBytes } from "@/lib/format"; const cores = (v: number | null) => (v == null ? "—" : v.toFixed(v >= 10 ? 0 : 1)); function Cell({ label, value, note }: { label: string; value: string; note?: string }) { return (
{label} {value} {note && {note}}
); } /** Resource use sampled during a run: per deployment (A/B: both sides) and per GPU. */ export function BenchmarkResources({ stats, names }: { stats: ResourceStats; names?: { a: string; b?: string } }) { if (stats.samples === 0 && stats.gpus.length === 0) return

No resource samples were recorded.

; const multi = stats.containers.length > 1; return (
{stats.containers.map((c) => (
{multi && {c.side === "a" ? `A · ${names?.a ?? ""}` : `B · ${names?.b ?? ""}`}}
{c.memPeakBytes != null && c.memLimitBytes ? ( ) : ( )}
))} {stats.gpus.map((g) => (
GPU {g.index} · {g.name}
))}

Sampled every ~2 s over {stats.seconds} s ({stats.samples} samples). RAM is the container's usage without page cache, like docker stats; GPU figures are for the whole GPU, so other work on it counts too.

); }