@loadmap/react 0.40.0 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -32
- package/dist/{Loadmap-DbAbcbNc.js → Loadmap-CM8HshXp.js} +1287 -1897
- package/dist/{Loadmap-BMlU1-mr.d.ts → Loadmap-CyxcmVoc.d.ts} +69 -16
- package/dist/camera-RqbxjjVv.js +209 -0
- package/dist/framePanels-BL9_bQ8A.js +24 -0
- package/dist/index.d.ts +128 -37
- package/dist/index.js +5 -2
- package/dist/later-_c1UnFld.js +195 -0
- package/dist/panels-CemD3oVS.js +479 -0
- package/dist/scenarios-D7DDcwS5.js +521 -0
- package/dist/source.d.ts +1 -1
- package/dist/source.js +5 -2
- package/dist/story-mK-TEB6j.js +127 -0
- package/dist/{zoom-DGmIQ7aO.js → zoom-36lBVilV.js} +45 -8
- package/package.json +5 -5
- package/dist/later-DpL22rlH.js +0 -504
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
import { d as isOn, f as plusMinus, l as LoadRange } from "./Loadmap-CM8HshXp.js";
|
|
2
|
+
import { sourceText } from "@loadmap/core";
|
|
3
|
+
import { compact, duration, fmt, multiple, multiples, pct, secs } from "@loadmap/core/format";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/panels.tsx
|
|
7
|
+
/** The model's one-sentence answer for the current values, and which capacity to measure when it is unsure. */
|
|
8
|
+
function Verdict({ lm }) {
|
|
9
|
+
const { measure } = lm.ev;
|
|
10
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
|
|
11
|
+
className: "lm-verdict",
|
|
12
|
+
"data-tier": lm.ev.verdict.tier,
|
|
13
|
+
"aria-live": "polite",
|
|
14
|
+
children: lm.ev.verdict.text
|
|
15
|
+
}), measure && /* @__PURE__ */ jsx("p", {
|
|
16
|
+
className: "lm-measure",
|
|
17
|
+
"data-component": measure.component,
|
|
18
|
+
children: measure.text
|
|
19
|
+
})] });
|
|
20
|
+
}
|
|
21
|
+
/** The tag beside a component's name when its capacity is not plainly measured: estimated, published, a range, none. */
|
|
22
|
+
function CapTag({ c, short }) {
|
|
23
|
+
const pm = plusMinus(c ?? null);
|
|
24
|
+
const kind = c?.missing != null ? "none" : c?.ref ? "published" : c?.provenance === "estimated" ? "estimated" : "range";
|
|
25
|
+
const word = {
|
|
26
|
+
none: short ? "none" : "no published benchmark",
|
|
27
|
+
published: short ? "pub" : "published",
|
|
28
|
+
estimated: short ? "est" : "estimate",
|
|
29
|
+
range: ""
|
|
30
|
+
}[kind];
|
|
31
|
+
if (kind === "range" && !pm) return null;
|
|
32
|
+
return /* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: "lm-tag",
|
|
34
|
+
"data-kind": kind,
|
|
35
|
+
children: short && kind === "range" ? "±" : [word, short ? "" : pm].filter(Boolean).join(" ")
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/** Each component's utilization in the order they reach the target, with where they cross it and 100 %. */
|
|
39
|
+
function Limits({ lm, title = "Where it runs out, in order" }) {
|
|
40
|
+
const { ev, model } = lm;
|
|
41
|
+
const top = Math.max(1.5, model.thresholds.full * 1.5);
|
|
42
|
+
const at = (u) => `${u / top * 100}%`;
|
|
43
|
+
const span = (r, x) => r ? multiples(r, model.searchMax, true) : multiple(x, model.searchMax);
|
|
44
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
45
|
+
/* @__PURE__ */ jsx("h3", { children: title }),
|
|
46
|
+
/* @__PURE__ */ jsxs("div", {
|
|
47
|
+
className: "lm-scale",
|
|
48
|
+
"aria-hidden": "true",
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx("span", {}),
|
|
51
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
52
|
+
/* @__PURE__ */ jsx("span", {
|
|
53
|
+
style: {
|
|
54
|
+
left: 0,
|
|
55
|
+
transform: "none"
|
|
56
|
+
},
|
|
57
|
+
children: "0"
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ jsxs("span", {
|
|
60
|
+
style: { left: at(model.thresholds.target) },
|
|
61
|
+
children: [pct(model.thresholds.target), " target"]
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ jsx("span", {
|
|
64
|
+
style: { left: at(model.thresholds.full) },
|
|
65
|
+
children: pct(model.thresholds.full)
|
|
66
|
+
}),
|
|
67
|
+
/* @__PURE__ */ jsx("span", {
|
|
68
|
+
style: {
|
|
69
|
+
left: "100%",
|
|
70
|
+
transform: "translateX(-100%)"
|
|
71
|
+
},
|
|
72
|
+
children: pct(top)
|
|
73
|
+
})
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ jsx("span", {})
|
|
76
|
+
]
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ jsx("div", {
|
|
79
|
+
className: "lm-limits",
|
|
80
|
+
children: ev.ranked.map((c) => /* @__PURE__ */ jsxs("div", {
|
|
81
|
+
className: "lm-lim",
|
|
82
|
+
"data-component": c.id,
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
85
|
+
/* @__PURE__ */ jsxs("b", { children: [
|
|
86
|
+
c.name,
|
|
87
|
+
c === ev.firstLimit && /* @__PURE__ */ jsx("span", {
|
|
88
|
+
className: "lm-tag",
|
|
89
|
+
"data-kind": "first",
|
|
90
|
+
children: "limit"
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ jsx(CapTag, { c: c.capacity })
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ jsx("span", {
|
|
95
|
+
className: "lm-sub",
|
|
96
|
+
children: c.missing != null ? `No published benchmark ${c.missing}.` : c.describe ?? (c.capacity ? `${fmt(c.capacity.value)} ${c.capacity.unit}` : "switched off")
|
|
97
|
+
}),
|
|
98
|
+
c.spread && c.util != null && /* @__PURE__ */ jsx("span", {
|
|
99
|
+
className: "lm-sub lm-spread",
|
|
100
|
+
children: c.spread.text
|
|
101
|
+
})
|
|
102
|
+
] }),
|
|
103
|
+
/* @__PURE__ */ jsxs("div", {
|
|
104
|
+
className: "lm-track",
|
|
105
|
+
role: "img",
|
|
106
|
+
"aria-label": `${c.name} at ${c.missing != null ? "no published benchmark" : c.util == null ? "off" : pct(c.util)}`,
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ jsx("div", {
|
|
109
|
+
className: "lm-fill",
|
|
110
|
+
"data-state": c.state,
|
|
111
|
+
style: { width: `${Math.min(100, (c.util ?? 0) / top * 100)}%` }
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ jsx("div", {
|
|
114
|
+
className: "lm-tick",
|
|
115
|
+
style: { left: at(model.thresholds.target) }
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ jsx("div", {
|
|
118
|
+
className: "lm-tick",
|
|
119
|
+
style: { left: at(model.thresholds.full) }
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ jsxs("div", {
|
|
124
|
+
className: "lm-val",
|
|
125
|
+
children: [c.util == null ? "—" : `${pct(c.util)} · ${num(c.demand ?? 0)} ${c.capacity?.unit ?? ""}`, /* @__PURE__ */ jsx("small", { children: c.util == null ? "switched off" : `${pct(model.thresholds.target)} at ${span(c.targetRange, c.target)} · full at ${span(c.fullRange, c.full)}` })]
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
}, c.id))
|
|
129
|
+
})
|
|
130
|
+
] });
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Live numbers: from the sim, lag and drops per queue, busy workers, rejected requests; from the model, pods running,
|
|
134
|
+
* cache answers and retries.
|
|
135
|
+
*/
|
|
136
|
+
function Meters({ lm }) {
|
|
137
|
+
const [, tick] = useState(0);
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
const t = setInterval(() => tick((x) => x + 1), 250);
|
|
140
|
+
return () => clearInterval(t);
|
|
141
|
+
}, []);
|
|
142
|
+
const { ev, engine, model } = lm;
|
|
143
|
+
const sim = engine.sim;
|
|
144
|
+
const flowLabel = (f) => model.def.flows[f]?.label ?? f;
|
|
145
|
+
const items = [];
|
|
146
|
+
for (const s of Object.values(ev.stages)) {
|
|
147
|
+
if (s.kind === "queue") for (const f of model.flowIds.filter((x) => ev.paths[x]?.some((p) => p.stages.includes(s.id)))) {
|
|
148
|
+
const q = sim.queue(s.id, f);
|
|
149
|
+
const rules = ev.overload[f] ?? {};
|
|
150
|
+
items.push({
|
|
151
|
+
key: `${s.id}/${f}/lag`,
|
|
152
|
+
value: secs(q.lag),
|
|
153
|
+
label: `${flowLabel(f)} lag in ${s.label}`,
|
|
154
|
+
state: q.lag > 60 ? "over" : q.lag > 5 ? "warn" : "ok"
|
|
155
|
+
});
|
|
156
|
+
if (rules.merge) items.push({
|
|
157
|
+
key: `${s.id}/${f}/merge`,
|
|
158
|
+
value: compact(q.merged),
|
|
159
|
+
label: `${flowLabel(f)} superseded /s (${rules.merge.reason ?? "newest kept"})`,
|
|
160
|
+
state: q.merged > .5 ? "warn" : "ok"
|
|
161
|
+
});
|
|
162
|
+
if (rules.drop) items.push({
|
|
163
|
+
key: `${s.id}/${f}/drop`,
|
|
164
|
+
value: compact(q.dropped),
|
|
165
|
+
label: `${flowLabel(f)} dropped /s (${rules.drop.reason ?? "too old"})`,
|
|
166
|
+
state: q.dropped > .5 ? "over" : "ok"
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (s.kind === "workers") {
|
|
170
|
+
const b = sim.busy(s.id);
|
|
171
|
+
items.push({
|
|
172
|
+
key: `${s.id}/busy`,
|
|
173
|
+
value: pct(b),
|
|
174
|
+
label: `${s.label} busy`,
|
|
175
|
+
state: b > .95 ? "over" : b > .5 ? "warn" : "ok"
|
|
176
|
+
});
|
|
177
|
+
if (s.autoscale) items.push({
|
|
178
|
+
key: `${s.id}/pods`,
|
|
179
|
+
value: `${s.running} of ${s.pods}`,
|
|
180
|
+
label: `${s.label} pods running`,
|
|
181
|
+
state: s.running < s.pods ? "ok" : (ev.components[s.component]?.util ?? 0) > model.thresholds.full ? "over" : "warn"
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
if (s.kind === "cache") items.push({
|
|
185
|
+
key: `${s.id}/hits`,
|
|
186
|
+
value: compact(sim.arriving(s.id) * (1 - sim.shed(s.id)) * s.hit),
|
|
187
|
+
label: `answered at ${s.label} /s (${pct(s.hit)} hits)`,
|
|
188
|
+
state: "ok"
|
|
189
|
+
});
|
|
190
|
+
if ((s.kind === "pass" || s.kind === "limit" || s.kind === "cache" || s.kind === "split") && sim.shed(s.id) > 0) items.push({
|
|
191
|
+
key: `${s.id}/shed`,
|
|
192
|
+
value: pct(sim.shed(s.id)),
|
|
193
|
+
label: `rejected at ${s.label}`,
|
|
194
|
+
state: "over"
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
for (const f of model.flowIds) {
|
|
198
|
+
const r = ev.retry[f];
|
|
199
|
+
if (!r || !(r.rate > 0)) continue;
|
|
200
|
+
const per = r.attempts / r.rate;
|
|
201
|
+
items.push({
|
|
202
|
+
key: `${f}/attempts`,
|
|
203
|
+
value: `${fmt(per)}×`,
|
|
204
|
+
label: `${flowLabel(f)} attempts per ${model.def.flows[f]?.unit ?? "unit"}`,
|
|
205
|
+
state: per > 1.05 ? "warn" : "ok"
|
|
206
|
+
});
|
|
207
|
+
items.push({
|
|
208
|
+
key: `${f}/failed`,
|
|
209
|
+
value: pct(r.failed),
|
|
210
|
+
label: `${flowLabel(f)} failing after ${r.times} ${r.times === 1 ? "retry" : "retries"}`,
|
|
211
|
+
state: r.failed > .005 ? "over" : "ok"
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
for (const f of model.flowIds) {
|
|
215
|
+
const l = ev.latency[f];
|
|
216
|
+
if (!l) continue;
|
|
217
|
+
const scenario = model.scenarioOf(lm.values)?.label;
|
|
218
|
+
const goal = model.expectations.find((e) => e.flow === f && e.p99 != null && (e.scenario == null || e.scenario === scenario) && (e.underTarget == null || lm.values.load <= e.underTarget))?.p99;
|
|
219
|
+
items.push({
|
|
220
|
+
key: `${f}/p99`,
|
|
221
|
+
value: duration(l.p99),
|
|
222
|
+
label: `${flowLabel(f)} p99`,
|
|
223
|
+
state: !Number.isFinite(l.p99) || goal != null && l.p99 > goal ? "over" : "ok"
|
|
224
|
+
});
|
|
225
|
+
if (l.timedOut != null) items.push({
|
|
226
|
+
key: `${f}/late`,
|
|
227
|
+
value: pct(l.timedOut),
|
|
228
|
+
label: `${flowLabel(f)} timed out`,
|
|
229
|
+
state: l.timedOut > .005 ? "over" : l.timedOut > 0 ? "warn" : "ok"
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("h3", { children: "Live" }), /* @__PURE__ */ jsx("div", {
|
|
233
|
+
className: "lm-meters",
|
|
234
|
+
children: items.map((m) => /* @__PURE__ */ jsxs("div", {
|
|
235
|
+
className: "lm-meter",
|
|
236
|
+
"data-state": m.state,
|
|
237
|
+
children: [/* @__PURE__ */ jsx("b", { children: m.value }), /* @__PURE__ */ jsx("span", {
|
|
238
|
+
title: m.label,
|
|
239
|
+
children: m.label
|
|
240
|
+
})]
|
|
241
|
+
}, m.key))
|
|
242
|
+
})] });
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* The load slider (unless `load` is false: the page shows a `LoadBar`), the presets that set no load, and every
|
|
246
|
+
* parameter, greyed out where it does not apply.
|
|
247
|
+
*/
|
|
248
|
+
function Controls({ lm, load = true }) {
|
|
249
|
+
const { model, values, setValues, ev } = lm;
|
|
250
|
+
const v = values;
|
|
251
|
+
const presets = ev.presets.filter((p) => !("load" in p.values));
|
|
252
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
253
|
+
className: "lm-card lm-controls",
|
|
254
|
+
children: [
|
|
255
|
+
load && /* @__PURE__ */ jsx("h3", { children: "Load" }),
|
|
256
|
+
load && /* @__PURE__ */ jsx(LoadRange, { lm }),
|
|
257
|
+
presets.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
258
|
+
className: "lm-presets",
|
|
259
|
+
children: presets.map((p) => /* @__PURE__ */ jsx("button", {
|
|
260
|
+
type: "button",
|
|
261
|
+
"aria-pressed": isOn(lm, p),
|
|
262
|
+
onClick: () => setValues(p.values),
|
|
263
|
+
children: p.label
|
|
264
|
+
}, p.label))
|
|
265
|
+
}),
|
|
266
|
+
model.params.length > 1 && /* @__PURE__ */ jsx("h3", { children: "Design" }),
|
|
267
|
+
model.params.map(({ id, def }) => {
|
|
268
|
+
if (def.kind === "load") return null;
|
|
269
|
+
const enabled = model.isEnabled(id, v);
|
|
270
|
+
const tag = def.tag && /* @__PURE__ */ jsx("span", {
|
|
271
|
+
className: "lm-tag",
|
|
272
|
+
"data-kind": "estimated",
|
|
273
|
+
children: def.tag
|
|
274
|
+
});
|
|
275
|
+
if (def.kind === "switch") return /* @__PURE__ */ jsxs("label", {
|
|
276
|
+
className: `lm-switch${enabled ? "" : " lm-off"}`,
|
|
277
|
+
children: [
|
|
278
|
+
/* @__PURE__ */ jsx("input", {
|
|
279
|
+
type: "checkbox",
|
|
280
|
+
checked: Boolean(v[id]),
|
|
281
|
+
disabled: !enabled,
|
|
282
|
+
onChange: (e) => setValues({ [id]: e.target.checked })
|
|
283
|
+
}),
|
|
284
|
+
/* @__PURE__ */ jsxs("span", { children: [def.label, tag] }),
|
|
285
|
+
def.hint && /* @__PURE__ */ jsx("small", { children: def.hint })
|
|
286
|
+
]
|
|
287
|
+
}, id);
|
|
288
|
+
if (def.kind === "select") return /* @__PURE__ */ jsxs("label", {
|
|
289
|
+
className: `lm-select${enabled ? "" : " lm-off"}`,
|
|
290
|
+
children: [
|
|
291
|
+
/* @__PURE__ */ jsxs("span", { children: [def.label, tag] }),
|
|
292
|
+
/* @__PURE__ */ jsx("select", {
|
|
293
|
+
value: String(v[id]),
|
|
294
|
+
disabled: !enabled,
|
|
295
|
+
onChange: (e) => {
|
|
296
|
+
const opt = def.options.find((o) => String(o) === e.target.value);
|
|
297
|
+
setValues({ [id]: opt });
|
|
298
|
+
},
|
|
299
|
+
children: def.options.map((o) => /* @__PURE__ */ jsx("option", {
|
|
300
|
+
value: String(o),
|
|
301
|
+
children: def.format ? def.format(o) : String(o)
|
|
302
|
+
}, String(o)))
|
|
303
|
+
}),
|
|
304
|
+
def.hint && /* @__PURE__ */ jsx("small", { children: def.hint })
|
|
305
|
+
]
|
|
306
|
+
}, id);
|
|
307
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
308
|
+
className: `lm-range${enabled ? "" : " lm-off"}`,
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
311
|
+
def.label,
|
|
312
|
+
tag,
|
|
313
|
+
" ",
|
|
314
|
+
/* @__PURE__ */ jsx("output", { children: def.format ? def.format(v[id]) : fmt(v[id]) })
|
|
315
|
+
] }),
|
|
316
|
+
/* @__PURE__ */ jsx("input", {
|
|
317
|
+
type: "range",
|
|
318
|
+
min: def.min,
|
|
319
|
+
max: def.max,
|
|
320
|
+
step: def.step,
|
|
321
|
+
value: v[id],
|
|
322
|
+
disabled: !enabled,
|
|
323
|
+
onChange: (e) => setValues({ [id]: Number(e.target.value) })
|
|
324
|
+
}),
|
|
325
|
+
def.hint && /* @__PURE__ */ jsx("small", { children: def.hint })
|
|
326
|
+
]
|
|
327
|
+
}, id);
|
|
328
|
+
})
|
|
329
|
+
]
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
/** What the model assumes: every capacity with its provenance, every fit, and anything the page adds. */
|
|
333
|
+
function Assumptions({ lm, extra = [] }) {
|
|
334
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
335
|
+
className: "lm-card",
|
|
336
|
+
children: [/* @__PURE__ */ jsx("h3", { children: "What this assumes" }), /* @__PURE__ */ jsxs("ul", {
|
|
337
|
+
className: "lm-facts",
|
|
338
|
+
children: [extra.map((x, i) => /* @__PURE__ */ jsx("li", { children: x }, i)), lm.ev.assumptions.map((a) => /* @__PURE__ */ jsx("li", { children: describe(a) }, a.kind === "capacity" ? `c:${a.component}` : `${a.kind}:${a.name}`))]
|
|
339
|
+
})]
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
function describe(a) {
|
|
343
|
+
if (a.kind === "capacity") {
|
|
344
|
+
const c = a.capacity;
|
|
345
|
+
if (c.missing != null) return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
346
|
+
/* @__PURE__ */ jsxs("b", { children: [a.name, ":"] }),
|
|
347
|
+
" no capacity:",
|
|
348
|
+
" ",
|
|
349
|
+
/* @__PURE__ */ jsx("span", {
|
|
350
|
+
className: "lm-prov",
|
|
351
|
+
"data-kind": "published",
|
|
352
|
+
children: "no published benchmark"
|
|
353
|
+
}),
|
|
354
|
+
" ",
|
|
355
|
+
c.missing,
|
|
356
|
+
".",
|
|
357
|
+
unread(c.unread)
|
|
358
|
+
] });
|
|
359
|
+
if (c.ref) return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Published, {
|
|
360
|
+
name: a.name,
|
|
361
|
+
c
|
|
362
|
+
}), unread(c.unread)] });
|
|
363
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
364
|
+
/* @__PURE__ */ jsxs("b", { children: [a.name, ":"] }),
|
|
365
|
+
" ",
|
|
366
|
+
c.unit === "share" ? pct(c.value) : `${fmt(c.value)} ${c.unit}`,
|
|
367
|
+
c.within ? ` ${plusMinus(c)}` : "",
|
|
368
|
+
",",
|
|
369
|
+
" ",
|
|
370
|
+
/* @__PURE__ */ jsx("span", {
|
|
371
|
+
className: "lm-prov",
|
|
372
|
+
"data-kind": c.provenance,
|
|
373
|
+
children: c.provenance
|
|
374
|
+
}),
|
|
375
|
+
c.source ? ` (${c.source})` : "",
|
|
376
|
+
".",
|
|
377
|
+
unread(c.unread)
|
|
378
|
+
] });
|
|
379
|
+
}
|
|
380
|
+
if (a.kind === "connection") return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
381
|
+
/* @__PURE__ */ jsxs("b", { children: [a.name, ":"] }),
|
|
382
|
+
" ",
|
|
383
|
+
a.text
|
|
384
|
+
] });
|
|
385
|
+
if (a.kind === "measurement") {
|
|
386
|
+
const { label, unit, value, missing, source } = a.measurement;
|
|
387
|
+
const name = label ?? a.name;
|
|
388
|
+
if (missing != null) return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("b", { children: [name, ":"] }), unread(missing)] });
|
|
389
|
+
return describe({
|
|
390
|
+
kind: "capacity",
|
|
391
|
+
component: "",
|
|
392
|
+
name,
|
|
393
|
+
capacity: {
|
|
394
|
+
value,
|
|
395
|
+
unit,
|
|
396
|
+
provenance: "measured",
|
|
397
|
+
source
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
const f = a.fit;
|
|
402
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
403
|
+
/* @__PURE__ */ jsxs("b", { children: [a.name, ":"] }),
|
|
404
|
+
" ",
|
|
405
|
+
f.y,
|
|
406
|
+
" = ",
|
|
407
|
+
sig(f.a),
|
|
408
|
+
" + ",
|
|
409
|
+
sig(f.b),
|
|
410
|
+
" × ",
|
|
411
|
+
f.x,
|
|
412
|
+
", r² ",
|
|
413
|
+
f.r2.toFixed(3),
|
|
414
|
+
" over ",
|
|
415
|
+
f.n,
|
|
416
|
+
" points,",
|
|
417
|
+
" ",
|
|
418
|
+
/* @__PURE__ */ jsx("span", {
|
|
419
|
+
className: "lm-prov",
|
|
420
|
+
"data-kind": "measured",
|
|
421
|
+
children: "measured"
|
|
422
|
+
}),
|
|
423
|
+
f.source ? ` (${f.source})` : "",
|
|
424
|
+
".",
|
|
425
|
+
unread(f.unread)
|
|
426
|
+
] });
|
|
427
|
+
}
|
|
428
|
+
/** A snapshot that gave no value: the line says the written one stands in. */
|
|
429
|
+
const unread = (why) => why == null ? "" : ` No data from the snapshot (${why}).`;
|
|
430
|
+
/** A published figure with what it is, its conditions and where it comes from: a vendor's run, not this system. */
|
|
431
|
+
function Published({ name, c }) {
|
|
432
|
+
const r = c.ref;
|
|
433
|
+
const runs = r.versions.join(", ");
|
|
434
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
435
|
+
/* @__PURE__ */ jsxs("b", { children: [name, ":"] }),
|
|
436
|
+
" ",
|
|
437
|
+
fmt(c.value),
|
|
438
|
+
" ",
|
|
439
|
+
c.unit,
|
|
440
|
+
c.within ? ` ${plusMinus(c)}` : "",
|
|
441
|
+
",",
|
|
442
|
+
" ",
|
|
443
|
+
/* @__PURE__ */ jsx("span", {
|
|
444
|
+
className: "lm-prov",
|
|
445
|
+
"data-kind": "published",
|
|
446
|
+
children: r.measure === "limit" ? "published limit" : "published"
|
|
447
|
+
}),
|
|
448
|
+
": ",
|
|
449
|
+
r.name,
|
|
450
|
+
", ",
|
|
451
|
+
r.what,
|
|
452
|
+
", ",
|
|
453
|
+
r.scope,
|
|
454
|
+
" (",
|
|
455
|
+
r.conditions.join("; "),
|
|
456
|
+
"); ",
|
|
457
|
+
r.name,
|
|
458
|
+
" ",
|
|
459
|
+
runs,
|
|
460
|
+
r.version && r.version !== runs ? `, you run ${r.version}` : "",
|
|
461
|
+
"; ",
|
|
462
|
+
sourceText(r),
|
|
463
|
+
" (",
|
|
464
|
+
/^https:\/\//.test(r.source.url) ? /* @__PURE__ */ jsx("a", {
|
|
465
|
+
href: r.source.url,
|
|
466
|
+
target: "_blank",
|
|
467
|
+
rel: "noopener noreferrer",
|
|
468
|
+
children: "source"
|
|
469
|
+
}) : r.source.url,
|
|
470
|
+
", catalog ",
|
|
471
|
+
r.edition,
|
|
472
|
+
").",
|
|
473
|
+
r.measure === "limit" ? "" : " A best case elsewhere, not a measurement of this system."
|
|
474
|
+
] });
|
|
475
|
+
}
|
|
476
|
+
/** Exact below 1,000 (3.9 cores), compact above (12k req/s). */
|
|
477
|
+
const num = (x) => Math.abs(x) >= 1e3 ? compact(x) : fmt(x);
|
|
478
|
+
const sig = (x) => Number(x.toPrecision(3)).toString();
|
|
479
|
+
export { Verdict as a, Meters as i, Controls as n, Limits as r, Assumptions as t };
|