@milabench/bujang 0.1.22 → 0.1.23
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/dist/index.js +1961 -1943
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/views/OverviewPanels.tsx +28 -5
package/package.json
CHANGED
|
@@ -537,7 +537,7 @@ const STATS: StatName[] = ['count', 'mean', 'std', 'min', 'median', 'p95', 'p99'
|
|
|
537
537
|
|
|
538
538
|
const STAT_HELP: Partial<Record<StatName, string>> = {
|
|
539
539
|
total: 'sum of the values',
|
|
540
|
-
busy: 'total over the time from the first start to the last end of these rows',
|
|
540
|
+
busy: 'total over the time from the first start to the last end of these rows (above 100% when they overlap: workers combined)',
|
|
541
541
|
};
|
|
542
542
|
|
|
543
543
|
const splitBy = (by: string | undefined) => (by ?? '').split(',').map((f) => f.trim()).filter(Boolean);
|
|
@@ -571,9 +571,9 @@ const formatStat = (value: number) => {
|
|
|
571
571
|
return size !== 0 && size < 1e-3 ? value.toExponential(3) : String(+value.toPrecision(5));
|
|
572
572
|
};
|
|
573
573
|
|
|
574
|
-
/** The table rows of a metric: one, or one per value of its `by` fields, the largest total first */
|
|
575
|
-
const metricRows = (m: StatsMetric, rows: Record<string, unknown>[]): { label: string | null; stats: Stats | null }[] => {
|
|
576
|
-
const by = splitBy(m.by);
|
|
574
|
+
/** The table rows of a metric: one, or one per value of its `by` fields (but the `combined` ones), the largest total first */
|
|
575
|
+
const metricRows = (m: StatsMetric, rows: Record<string, unknown>[], combined: string[] = []): { label: string | null; stats: Stats | null }[] => {
|
|
576
|
+
const by = splitBy(m.by).filter((f) => !combined.includes(f));
|
|
577
577
|
const groups = new Map<string, Record<string, unknown>[]>();
|
|
578
578
|
rows.forEach((r) => {
|
|
579
579
|
if (!isNumber(valueOf(r, m.field))) return;
|
|
@@ -627,6 +627,9 @@ export const StatsPanel: React.FC<PanelProps<'stats'>> = ({ jrJobId, files, pane
|
|
|
627
627
|
const error = results.find((r) => r.error)?.error as ApiError | undefined;
|
|
628
628
|
const rowsOf = (event: string) => results[events.indexOf(event)]?.data;
|
|
629
629
|
const truncated = results.some((r) => (r.data?.length ?? 0) >= ROW_LIMIT);
|
|
630
|
+
// the `by` fields of the metrics: each one can be combined (its values in one row: the workers together)
|
|
631
|
+
const byFields = useMemo(() => [...new Set(metrics.flatMap((m) => splitBy(m.by)))], [metrics]);
|
|
632
|
+
const [combined, setCombined] = useState<string[]>([]);
|
|
630
633
|
|
|
631
634
|
return (
|
|
632
635
|
<PanelFrame
|
|
@@ -636,6 +639,26 @@ export const StatsPanel: React.FC<PanelProps<'stats'>> = ({ jrJobId, files, pane
|
|
|
636
639
|
onSettings={() => setOpen(true)}
|
|
637
640
|
settingsTitle="Pick the fields of the stats"
|
|
638
641
|
info={<>
|
|
642
|
+
{metrics.length > 0 && byFields.length > 0 && (
|
|
643
|
+
<HStack gap={1}>
|
|
644
|
+
<Text>a row per</Text>
|
|
645
|
+
{byFields.map((field) => {
|
|
646
|
+
const on = !combined.includes(field);
|
|
647
|
+
return (
|
|
648
|
+
<Button
|
|
649
|
+
key={field}
|
|
650
|
+
size="2xs"
|
|
651
|
+
variant={on ? 'solid' : 'outline'}
|
|
652
|
+
aria-pressed={on}
|
|
653
|
+
onClick={() => setCombined(on ? [...combined, field] : combined.filter((f) => f !== field))}
|
|
654
|
+
title={on ? `Combine the values of ${field} in one row` : `A row per value of ${field}`}
|
|
655
|
+
>
|
|
656
|
+
{field}
|
|
657
|
+
</Button>
|
|
658
|
+
);
|
|
659
|
+
})}
|
|
660
|
+
</HStack>
|
|
661
|
+
)}
|
|
639
662
|
{results.some((r) => r.isFetching) && <Spinner size="xs" />}
|
|
640
663
|
{truncated && <Text>first {ROW_LIMIT} rows only</Text>}
|
|
641
664
|
</>}
|
|
@@ -661,7 +684,7 @@ export const StatsPanel: React.FC<PanelProps<'stats'>> = ({ jrJobId, files, pane
|
|
|
661
684
|
<Table.Body>
|
|
662
685
|
{metrics.map((m, i) => {
|
|
663
686
|
const rows = rowsOf(m.event);
|
|
664
|
-
const lines = rows ? metricRows(m, rows) : [{ label: null, stats: null }];
|
|
687
|
+
const lines = rows ? metricRows(m, rows, combined) : [{ label: null, stats: null }];
|
|
665
688
|
return lines.map(({ label, stats }) => (
|
|
666
689
|
<Table.Row key={`${i}:${m.event}:${m.field}:${label ?? ''}`}>
|
|
667
690
|
<Table.Cell fontFamily="mono" fontSize="xs" whiteSpace="nowrap" title={`${m.field} of the ${m.event || 'records'} rows`}>
|