Dashboard: time to first token tile and chart
vLLM: from the vllm:time_to_first_token_seconds histogram. MLX: the proxy times streamed requests from arrival to the first generated token. Each chart sample is the average over requests that got their first token in that 2 s window; idle samples are gaps, and isolated samples now draw as dots in every chart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QaE1hpvyZTJixEbUUMj9Ca
This commit is contained in:
parent
8611d92cf4
commit
994659b5e2
3 changed files with 50 additions and 8 deletions
|
|
@ -11,7 +11,7 @@
|
|||
--accent: #3b6ef5; --accent-weak: #e6edfe;
|
||||
--ok: #1f9d55; --ok-weak: #e3f5ea; --warn: #b7791f; --warn-weak: #fbf1dc;
|
||||
--bad: #d64545; --bad-weak: #fbe5e5;
|
||||
--c1: #3b6ef5; --c2: #0f9d8a; --c3: #c2620f; --c4: #d13d5e; --c5: #8a5cf0; --c6: #2f9e44;
|
||||
--c1: #3b6ef5; --c2: #0f9d8a; --c3: #c2620f; --c4: #d13d5e; --c5: #8a5cf0; --c6: #2f9e44; --c7: #b5179e;
|
||||
--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
color-scheme: light;
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
--accent: #6d93ff; --accent-weak: #1c2640;
|
||||
--ok: #3ccf7f; --ok-weak: #143022; --warn: #e3a94a; --warn-weak: #33280f;
|
||||
--bad: #f07272; --bad-weak: #3a1818;
|
||||
--c1: #6d93ff; --c2: #3fc9b4; --c3: #f0954a; --c4: #f2708c; --c5: #a98bff; --c6: #5fd27a;
|
||||
--c1: #6d93ff; --c2: #3fc9b4; --c3: #f0954a; --c4: #f2708c; --c5: #a98bff; --c6: #5fd27a; --c7: #e67ad1;
|
||||
color-scheme: dark;
|
||||
}
|
||||
}
|
||||
|
|
@ -96,7 +96,9 @@ button.danger { color: var(--bad); }
|
|||
.bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .4s; }
|
||||
|
||||
.charts { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 14px; }
|
||||
@media (max-width: 820px) { .charts { grid-template-columns: minmax(0, 1fr); } }
|
||||
.charts.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
||||
@media (max-width: 1100px) { .charts.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
||||
@media (max-width: 820px) { .charts, .charts.four { grid-template-columns: minmax(0, 1fr); } }
|
||||
.chart .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
|
||||
.chart .head span { font-size: 12px; color: var(--muted); }
|
||||
.chart .head b { font-size: 13px; font-variant-numeric: tabular-nums; }
|
||||
|
|
@ -171,6 +173,7 @@ pre {
|
|||
<div class="grid tiles">
|
||||
<div class="tile"><div class="k">Generation</div><div class="v" id="t-gen">—</div><div class="s" id="t-gen-s"></div></div>
|
||||
<div class="tile"><div class="k">Prompt processing</div><div class="v" id="t-prompt">—</div><div class="s" id="t-prompt-s"></div></div>
|
||||
<div class="tile"><div class="k">Time to first token</div><div class="v" id="t-ttft">—</div><div class="s" id="t-ttft-s"></div></div>
|
||||
<div class="tile"><div class="k">Requests</div><div class="v" id="t-req">—</div><div class="s" id="t-req-s"></div></div>
|
||||
<div class="tile"><div class="k">KV cache</div><div class="v" id="t-kv">—</div><div class="bar"><i id="b-kv"></i></div></div>
|
||||
<div class="tile"><div class="k">GPU</div><div class="v" id="t-util">—</div><div class="s" id="t-util-s"></div></div>
|
||||
|
|
@ -179,9 +182,10 @@ pre {
|
|||
<div class="tile"><div class="k">Prefix cache hits</div><div class="v" id="t-prefix">—</div><div class="s">prompt tokens reused</div></div>
|
||||
</div>
|
||||
|
||||
<div class="grid charts">
|
||||
<div class="grid charts four">
|
||||
<div class="panel chart"><div class="head"><span>Generation tok/s</span><b id="c-gen-v"></b></div><svg id="c-gen" viewBox="0 0 300 90" preserveAspectRatio="none"></svg><div class="axis"><span>10 min ago</span><span>now</span></div></div>
|
||||
<div class="panel chart"><div class="head"><span>Prompt processing tok/s</span><b id="c-prompt-v"></b></div><svg id="c-prompt" viewBox="0 0 300 90" preserveAspectRatio="none"></svg><div class="axis"><span>10 min ago</span><span>now</span></div></div>
|
||||
<div class="panel chart"><div class="head"><span>Time to first token</span><b id="c-ttft-v"></b></div><svg id="c-ttft" viewBox="0 0 300 90" preserveAspectRatio="none"></svg><div class="axis"><span>10 min ago</span><span>now</span></div></div>
|
||||
<div class="panel chart"><div class="head"><span>KV cache %</span><b id="c-kv-v"></b></div><svg id="c-kv" viewBox="0 0 300 90" preserveAspectRatio="none"></svg><div class="axis"><span>10 min ago</span><span>now</span></div></div>
|
||||
</div>
|
||||
<div class="grid charts">
|
||||
|
|
@ -246,6 +250,7 @@ const fmt = {
|
|||
big: (v) => v == null ? "—" : v >= 1e9 ? (v / 1e9).toFixed(2) + "B" : v >= 1e6 ? (v / 1e6).toFixed(1) + "M" : v >= 1e3 ? (v / 1e3).toFixed(1) + "k" : String(Math.round(v)),
|
||||
dur: (s) => { if (s == null) return ""; s = Math.floor(s); const d = Math.floor(s / 86400), h = Math.floor(s % 86400 / 3600), m = Math.floor(s % 3600 / 60);
|
||||
return d ? `${d}d ${h}h` : h ? `${h}h ${m}m` : m ? `${m}m ${s % 60}s` : `${s}s`; },
|
||||
secs: (v) => v == null ? "—" : v < 1 ? Math.round(v * 1000) + " ms" : v < 10 ? v.toFixed(2) + " s" : v.toFixed(1) + " s",
|
||||
ctx: (n) => n == null ? "" : n >= 1024 ? Math.round(n / 1024) + "k ctx" : n + " ctx",
|
||||
};
|
||||
|
||||
|
|
@ -324,6 +329,12 @@ function render(s) {
|
|||
$("t-gen-s").textContent = live && m.gen_total != null ? fmt.big(m.gen_total) + " generated" : "";
|
||||
setV("t-prompt", live ? fmt.n(m.prompt_tps, 0) : "—", "tok/s");
|
||||
$("t-prompt-s").textContent = live && m.prompt_total != null ? fmt.big(m.prompt_total) + " processed" : "";
|
||||
// Latest measured value, kept while idle (a request has to start for a new one).
|
||||
const tt = m.ttft_last != null ? fmt.secs(m.ttft_last).split(" ") : null;
|
||||
$("t-ttft").innerHTML = live && tt ? `${tt[0]}<small>${tt[1]}</small>` : "—";
|
||||
$("t-ttft-s").textContent = live && m.ttft_avg != null
|
||||
? `avg ${fmt.secs(m.ttft_avg)} · ${fmt.big(m.ttft_count)} req` + (s.backend === "mlx" ? " (streamed)" : "")
|
||||
: live ? "no requests yet" : "";
|
||||
$("t-req").innerHTML = live ? `${fmt.n(m.running)}<small>running</small>` : "—";
|
||||
$("t-req-s").textContent = live ? `${fmt.n(m.waiting)} waiting` + (m.preemptions ? ` · ${fmt.n(m.preemptions)} preempted` : "") : "";
|
||||
setV("t-kv", live ? fmt.n(m.kv_pct, 1) : "—", "%");
|
||||
|
|
@ -339,6 +350,7 @@ function render(s) {
|
|||
chartTimes = h.map((p) => p.t);
|
||||
chart("c-gen", h.map((p) => p.gen), "var(--c1)", null, (v) => fmt.n(v, 0) + " tok/s");
|
||||
chart("c-prompt", h.map((p) => p.prompt), "var(--c6)", null, (v) => fmt.n(v, 0) + " tok/s");
|
||||
chart("c-ttft", h.map((p) => p.ttft), "var(--c7)", null, (v) => fmt.secs(v));
|
||||
chart("c-util", h.map((p) => p.util), "var(--c2)", 100, (v) => fmt.pct(v));
|
||||
chart("c-kv", h.map((p) => p.kv), "var(--c3)", null, (v) => fmt.n(v, 1) + "%");
|
||||
// Fixed scales so the shape means something: 0–100 °C, and 0 to the board power limit.
|
||||
|
|
@ -368,10 +380,15 @@ function chart(id, vals, color, fixedMax, f) {
|
|||
else { d += `L${x(i)},${y(v)}`; area += `L${x(i)},${y(v)}`; }
|
||||
});
|
||||
if (segStart != null) area += `L${x(pts.length - 1)},${H}Z`;
|
||||
let dots = "";
|
||||
pts.forEach((v, i) => {
|
||||
if (v != null && pts[i - 1] == null && pts[i + 1] == null) dots += `M${x(i)},${y(v)}l0,0`;
|
||||
});
|
||||
svg.innerHTML =
|
||||
`<line x1="0" x2="${W}" y1="${H - 1}" y2="${H - 1}" stroke="var(--border)" />` +
|
||||
`<path d="${area}" fill="${color}" fill-opacity="0.12" />` +
|
||||
`<path d="${d}" fill="none" stroke="${color}" stroke-width="1.75" vector-effect="non-scaling-stroke" stroke-linejoin="round" />`;
|
||||
`<path d="${d}" fill="none" stroke="${color}" stroke-width="1.75" vector-effect="non-scaling-stroke" stroke-linejoin="round" />` +
|
||||
(dots ? `<path d="${dots}" fill="none" stroke="${color}" stroke-width="5" stroke-linecap="round" vector-effect="non-scaling-stroke" />` : "");
|
||||
svg._data = { pts, times, color, f, x, y };
|
||||
drawHover(svg);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue