Skip to content

Commit 423bf54

Browse files
feat: Irq tile metrics column
1 parent e630389 commit 423bf54

5 files changed

Lines changed: 47 additions & 3 deletions

File tree

src/api/entities.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ export const tileMetricsSchema = z.object({
249249
last_cpu: z.array(z.number().nullable()),
250250
minflt: z.array(z.number().nullable()),
251251
majflt: z.array(z.number().nullable()),
252-
priority: z.array(prioritySchema).optional(),
252+
interrupts: z.array(z.number().nullable()),
253+
priority: z.array(prioritySchema),
253254
});
254255

255256
export const tileTimerSchema = z.object({

src/features/Overview/LiveTileMetrics/DataRow.tsx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ type RowPick = (row: TileRowMetrics | undefined) => number | null | undefined;
153153
const pickBackp: RowPick = (r) => r?.backp_msgs;
154154
const pickNivcsw: RowPick = (r) => r?.nivcsw;
155155
const pickNvcsw: RowPick = (r) => r?.nvcsw;
156+
const pickIrq: RowPick = (r) => r?.interrupts;
156157

157158
function writeIncrement(el: HTMLElement, value: number, graded: boolean) {
158159
el.textContent = `+${value.toLocaleString()}`;
@@ -169,12 +170,14 @@ interface LiveCountIncrementProps {
169170
idx: number;
170171
pick: RowPick;
171172
graded?: boolean;
173+
blankOnFloating?: boolean;
172174
}
173175

174176
function LiveCountIncrement({
175177
idx,
176178
pick,
177179
graded = false,
180+
blankOnFloating = false,
178181
...cellProps
179182
}: LiveCountIncrementProps & CellProps) {
180183
const countRef = useRef<HTMLSpanElement>(null);
@@ -186,7 +189,27 @@ function LiveCountIncrement({
186189
let prevTick: number | null | undefined;
187190

188191
const handleUpdate = () => {
189-
const value = pick(store.get(rowAtom));
192+
const rowData = store.get(rowAtom);
193+
194+
if (blankOnFloating) {
195+
if (rowData?.priority === PriorityEnum.floating) {
196+
if (countRef.current) {
197+
countRef.current.textContent = "--";
198+
}
199+
if (incRef.current) {
200+
incRef.current.classList.add(styles.hidden);
201+
}
202+
prevTick = undefined;
203+
lastKnown = undefined;
204+
return;
205+
}
206+
207+
if (incRef.current) {
208+
incRef.current.classList.remove(styles.hidden);
209+
}
210+
}
211+
212+
const value = pick(rowData);
190213
const resolved = value ?? lastKnown;
191214
const inc =
192215
resolved != null && prevTick != null ? resolved - prevTick : 0;
@@ -208,7 +231,7 @@ function LiveCountIncrement({
208231
const unsub = store.sub(liveTileMetricsAtom, handleUpdate);
209232
handleUpdate();
210233
return unsub;
211-
}, [idx, pick, graded]);
234+
}, [idx, pick, graded, blankOnFloating]);
212235

213236
return (
214237
<Table.Cell {...cellProps}>
@@ -388,6 +411,13 @@ export const DataRow = memo(function DataRow({ idx }: DataRowProps) {
388411
<LiveCell idx={idx} write={writeMajflt} align="right" />
389412
<LiveCountIncrement idx={idx} pick={pickNivcsw} graded align="right" />
390413
<LiveCountIncrement idx={idx} pick={pickNvcsw} graded align="right" />
414+
<LiveCountIncrement
415+
idx={idx}
416+
pick={pickIrq}
417+
graded
418+
blankOnFloating
419+
align="right"
420+
/>
391421
</Table.Row>
392422
);
393423
});

src/features/Overview/LiveTileMetrics/atoms.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface TileRowMetrics {
1515
last_cpu?: number | null;
1616
minflt?: number | null;
1717
majflt?: number | null;
18+
interrupts?: number | null;
1819
priority?: Priority | null;
1920
}
2021

@@ -30,6 +31,7 @@ function getTileRow(m: TileMetrics, idx: number): TileRowMetrics {
3031
last_cpu: m.last_cpu[idx],
3132
minflt: m.minflt[idx],
3233
majflt: m.majflt[idx],
34+
interrupts: m.interrupts[idx],
3335
priority: m.priority?.[idx],
3436
};
3537
}

src/features/Overview/LiveTileMetrics/consts.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,13 @@ export const metricGroups: {
209209
headerColWidth: 150,
210210
headerColAlign: "right",
211211
},
212+
{
213+
uniqueName: "Irq",
214+
description:
215+
"The number of hardware interrupt requests handled since startup on the CPU the tile is pinned to. Not applicable to floating tiles.",
216+
headerColWidth: 160,
217+
headerColAlign: "right",
218+
},
212219
],
213220
},
214221
];

src/features/Overview/LiveTileMetrics/liveTileMetrics.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@
7171
&.high-increment {
7272
color: var(--high-increment-text-color);
7373
}
74+
75+
&.hidden {
76+
display: none;
77+
}
7478
}
7579

7680
&.critical {

0 commit comments

Comments
 (0)