Open History to see the last commit
1import {
2 ActivityIcon,
3 AlertTriangleIcon,
4 BatteryIcon,
5 ChevronDownIcon,
6 ChevronRightIcon,
7 CpuIcon,
8 DatabaseIcon,
9 GaugeIcon,
10 HardDriveIcon,
11 MemoryStickIcon,
12 RefreshCwIcon,
13 RotateCcwIcon,
14} from "lucide-react";
15import type {
16 BackgroundBooleanState,
17 ResourceAttributionEntry,
18 ResourceTelemetryAggregate,
19 ResourceTelemetryHistoryBucket,
20 ResourceTelemetryIoSemantics,
21 ResourceTelemetryProcess,
22 ResourceTelemetryProcessCategory,
23 ResourceTelemetryProcessSummary,
24 ResourceTelemetrySourceHealth,
25 ResourceTelemetrySourceStatus,
26 ServerProcessSignal,
27} from "@t3tools/contracts";
28import * as DateTime from "effect/DateTime";
29import * as Option from "effect/Option";
30import { useCallback, useMemo, useRef, useState, type ReactNode } from "react";
31import {
32 isAtomCommandInterrupted,
33 squashAtomCommandFailure,
34} from "@t3tools/client-runtime/state/runtime";
35
36import {
37 useResourceTelemetry,
38 useResourceTelemetryHistory,
39} from "../../lib/resourceTelemetryState";
40import { cn } from "../../lib/utils";
41import { ensureLocalApi } from "../../localApi";
42import { usePrimaryEnvironment } from "../../state/environments";
43import { serverEnvironment } from "../../state/server";
44import { useAtomCommand } from "../../state/use-atom-command";
45import { formatRelativeTime } from "../../timestampFormat";
46import { Button } from "../ui/button";
47import { ScrollArea } from "../ui/scroll-area";
48import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
49import { toastManager } from "../ui/toast";
50import {
51 resourceHistoryBarHeight,
52 resourceHistoryCpuScaleMax,
53 shouldShowResourceMonitorRetry,
54 visibleResourceTelemetryProcesses,
55} from "./ResourceTelemetryDiagnostics.logic";
56import { SettingsSection, useRelativeTimeTick } from "./settingsLayout";
57
58const HISTORY_WINDOWS = [
59 { label: "5m", windowMs: 5 * 60_000, bucketMs: 15_000 },
60 { label: "15m", windowMs: 15 * 60_000, bucketMs: 30_000 },
61 { label: "30m", windowMs: 30 * 60_000, bucketMs: 60_000 },
62 { label: "1h", windowMs: 60 * 60_000, bucketMs: 2 * 60_000 },
63] as const;
64
65function formatBytes(value: number): string {
66 if (value < 1_024) return `${Math.round(value)} B`;
67 const units = ["KB", "MB", "GB", "TB"] as const;
68 let next = value;
69 let unitIndex = -1;
70 do {
71 next /= 1_024;
72 unitIndex += 1;
73 } while (next >= 1_024 && unitIndex < units.length - 1);
74 return `${next.toFixed(next >= 100 ? 0 : next >= 10 ? 1 : 2)} ${units[unitIndex]}`;
75}
76
77function formatRate(value: number): string {
78 return `${formatBytes(value)}/s`;
79}
80
81function formatCpuTime(valueMs: number): string {
82 const seconds = valueMs / 1_000;
83 if (seconds < 60) return `${seconds.toFixed(seconds >= 10 ? 1 : 2)}s`;
84 const minutes = seconds / 60;
85 if (minutes < 60) return `${minutes.toFixed(minutes >= 10 ? 1 : 2)}m`;
86 return `${(minutes / 60).toFixed(2)}h`;
87}
88
89function formatDurationMicros(value: number): string {
90 if (value < 1_000) return `${Math.round(value)} µs`;
91 if (value < 1_000_000) return `${(value / 1_000).toFixed(2)} ms`;
92 return `${(value / 1_000_000).toFixed(2)} s`;
93}
94
95function formatSampleInterval(valueMs: number): string {
96 if (valueMs < 1_000) return `${Math.max(0, Math.round(valueMs))} ms`;
97 const seconds = valueMs / 1_000;
98 return `${seconds.toLocaleString(undefined, { maximumFractionDigits: 1 })} ${
99 seconds === 1 ? "second" : "seconds"
100 }`;
101}
102
103function processIdentityKey(process: ResourceTelemetryProcess): string {
104 return `${process.identity.pid}:${process.identity.startTimeMs}`;
105}
106
107function processSummaryIdentityKey(process: ResourceTelemetryProcessSummary): string {
108 return `${process.identity.pid}:${process.identity.startTimeMs}`;
109}
110
111function formatProcessName(process: Pick<ResourceTelemetryProcess, "command" | "name">): string {
112 if (process.name.trim()) return process.name;
113 const firstToken = process.command.trim().split(/\s+/)[0] ?? process.command;
114 const normalized = firstToken.replace(/^['"]|['"]$/g, "");
115 return normalized.split(/[\\/]/).findLast((segment) => segment.length > 0) ?? normalized;
116}
117
118function categoryLabel(category: ResourceTelemetryProcessCategory): string {
119 switch (category) {
120 case "server":
121 return "Server";
122 case "server-child":
123 return "Backend child";
124 case "provider-root":
125 return "Provider";
126 case "terminal-root":
127 return "Terminal";
128 case "electron-main":
129 return "Electron main";
130 case "electron-renderer":
131 return "Renderer";
132 case "electron-gpu":
133 return "GPU";
134 case "electron-utility":
135 return "Electron utility";
136 case "resource-monitor":
137 return "Monitor";
138 case "unknown-t3":
139 return "T3 process";
140 }
141}
142
143function categoryDotClass(category: ResourceTelemetryProcessCategory): string {
144 if (category === "resource-monitor") return "bg-amber-500";
145 if (category.startsWith("electron-")) return "bg-sky-500";
146 if (category === "server") return "bg-violet-500";
147 return "bg-emerald-500";
148}
149
150function ioSemanticsLabel(semantics: ResourceTelemetryIoSemantics): string {
151 switch (semantics) {
152 case "storage":
153 return "Storage bytes";
154 case "logical":
155 return "Logical bytes";
156 case "all-io":
157 return "All I/O bytes";
158 case "unavailable":
159 return "Unavailable";
160 }
161}
162
163function booleanStateLabel(
164 value: BackgroundBooleanState,
165 labels: { readonly true: string; readonly false: string },
166): string {
167 if (value === "true") return labels.true;
168 if (value === "false") return labels.false;
169 return "Unknown";
170}
171
172function sourceStatusTone(status: ResourceTelemetrySourceStatus): "default" | "warning" | "danger" {
173 if (status === "healthy") return "default";
174 if (status === "starting" || status === "degraded") return "warning";
175 return "danger";
176}
177
178function SourceStatusBadge({
179 label,
180 status,
181 presentation,
182}: {
183 label: string;
184 status: ResourceTelemetrySourceStatus;
185 presentation?:
186 | {
187 readonly label: string;
188 readonly tone: "neutral";
189 }
190 | undefined;
191}) {
192 const tone = presentation?.tone ?? sourceStatusTone(status);
193 return (
194 <span
195 className={cn(
196 "inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.08em]",
197 tone === "neutral" && "border-border/70 bg-muted/45 text-muted-foreground",
198 tone === "default" &&
199 "border-emerald-500/25 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
200 tone === "warning" &&
201 "border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",
202 tone === "danger" && "border-destructive/30 bg-destructive/10 text-destructive",
203 )}
204 >
205 <span
206 className={cn(
207 "size-1.5 rounded-full",
208 tone === "neutral" && "bg-muted-foreground/55",
209 tone === "default" && "bg-emerald-500",
210 tone === "warning" && "bg-amber-500",
211 tone === "danger" && "bg-destructive",
212 )}
213 />
214 {label} {presentation?.label ?? status}
215 </span>
216 );
217}
218
219function LastSampleLabel({ sampledAt }: { sampledAt: DateTime.Utc | null }) {
220 useRelativeTimeTick();
221 if (!sampledAt) {
222 return <span className="text-[11px] text-muted-foreground/55">Waiting for sample</span>;
223 }
224 const relative = formatRelativeTime(DateTime.formatIso(sampledAt));
225 if (!relative) {
226 return <span className="text-[11px] text-muted-foreground/55">Waiting for sample</span>;
227 }
228 return (
229 <span className="text-[11px] text-muted-foreground/60">
230 Updated <span className="font-mono tabular-nums">{relative.value}</span>
231 {relative.suffix ? ` ${relative.suffix}` : ""}
232 </span>
233 );
234}
235
236function IconStat({
237 icon,
238 label,
239 value,
240 detail,
241 tone = "default",
242}: {
243 icon: ReactNode;
244 label: string;
245 value: string;
246 detail?: string | undefined;
247 tone?: "default" | "warning" | "danger";
248}) {
249 return (
250 <div className="group min-w-0 px-4 py-4 sm:px-5">
251 <div className="flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.11em] text-muted-foreground/70">
252 <span className="text-muted-foreground/55 transition-colors group-hover:text-foreground/65">
253 {icon}
254 </span>
255 <span className="truncate">{label}</span>
256 </div>
257 <div
258 className={cn(
259 "mt-2.5 truncate font-mono text-2xl font-semibold tracking-[-0.05em] tabular-nums text-foreground",
260 tone === "warning" && "text-amber-600 dark:text-amber-300",
261 tone === "danger" && "text-destructive",
262 )}
263 >
264 {value}
265 </div>
266 {detail ? (
267 <div className="mt-1.5 truncate text-[10px] text-muted-foreground/60">{detail}</div>
268 ) : null}
269 </div>
270 );
271}
272
273function AggregateCard({
274 label,
275 accentClass,
276 aggregate,
277}: {
278 label: string;
279 accentClass: string;
280 aggregate: ResourceTelemetryAggregate;
281}) {
282 return (
283 <div className="relative overflow-hidden border-t border-border/60 px-4 py-4 first:border-t-0 md:border-t-0 md:border-l md:first:border-l-0 sm:px-5">
284 <span className={cn("absolute inset-x-5 top-0 h-0.5 rounded-full opacity-75", accentClass)} />
285 <div className="flex items-center justify-between gap-3">
286 <div className="text-[10px] font-semibold uppercase tracking-[0.11em] text-muted-foreground/75">
287 {label}
288 </div>
289 <div className="rounded-md bg-muted/55 px-1.5 py-0.5 font-mono text-[9px] tabular-nums text-muted-foreground/70">
290 {aggregate.processCount} {aggregate.processCount === 1 ? "process" : "processes"}
291 </div>
292 </div>
293 <div className="mt-3.5 grid grid-cols-2 gap-x-4 gap-y-2.5">
294 <MetricPair label="CPU" value={`${aggregate.currentCpuPercent.toFixed(1)}%`} />
295 <MetricPair label="Memory" value={formatBytes(aggregate.currentRssBytes)} />
296 <MetricPair label="Read" value={formatRate(aggregate.ioReadBytesPerSecond)} />
297 <MetricPair label="Write" value={formatRate(aggregate.ioWriteBytesPerSecond)} />
298 </div>
299 </div>
300 );
301}
302
303function MetricPair({ label, value }: { label: string; value: string }) {
304 return (
305 <div className="min-w-0">
306 <div className="text-[9px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/45">
307 {label}
308 </div>
309 <div className="truncate font-mono text-xs font-medium tabular-nums text-foreground/90">
310 {value}
311 </div>
312 </div>
313 );
314}
315
316function HealthSource({ label, health }: { label: string; health: ResourceTelemetrySourceHealth }) {
317 const expectedInBrowser =
318 health.status === "unavailable" &&
319 Option.exists(health.lastError, (error) => error.includes("'web' mode"));
320 return (
321 <div className="flex items-start justify-between gap-4 border-t border-border/50 py-3 first:border-t-0">
322 <div className="min-w-0">
323 <div className="text-[13px] font-medium text-foreground">{label}</div>
324 <div className="mt-1 text-[11px] leading-relaxed text-muted-foreground/65">
325 {expectedInBrowser
326 ? "Available when this page runs inside the desktop app."
327 : Option.match(health.lastError, {
328 onNone: () => "No reported errors",
329 onSome: (error) => error,
330 })}
331 </div>
332 </div>
333 <SourceStatusBadge
334 label=""
335 status={health.status}
336 presentation={
337 expectedInBrowser
338 ? {
339 label: "Desktop only",
340 tone: "neutral",
341 }
342 : undefined
343 }
344 />
345 </div>
346 );
347}
348
349function DetailRow({
350 label,
351 value,
352 valueClassName,
353}: {
354 label: string;
355 value: ReactNode;
356 valueClassName?: string | undefined;
357}) {
358 return (
359 <div className="flex items-center justify-between gap-4 border-t border-border/50 py-2.5 first:border-t-0">
360 <span className="text-[11px] text-muted-foreground/75">{label}</span>
361 <span
362 className={cn(
363 "min-w-0 truncate text-right font-mono text-[11px] tabular-nums text-foreground/85",
364 valueClassName,
365 )}
366 >
367 {value}
368 </span>
369 </div>
370 );
371}
372
373function HistoryWindowSelector({
374 selectedWindowMs,
375 onSelect,
376}: {
377 selectedWindowMs: number;
378 onSelect: (windowMs: number) => void;
379}) {
380 return (
381 <div className="flex items-center rounded-md border border-border/60 p-0.5">
382 {HISTORY_WINDOWS.map((option) => (
383 <button
384 key={option.windowMs}
385 type="button"
386 className={cn(
387 "cursor-pointer h-6 rounded-sm px-2 text-[11px] font-medium text-muted-foreground hover:text-foreground",
388 selectedWindowMs === option.windowMs && "bg-muted text-foreground",
389 )}
390 onClick={() => onSelect(option.windowMs)}
391 >
392 {option.label}
393 </button>
394 ))}
395 </div>
396 );
397}
398
399function ResourceHistoryChart({
400 buckets,
401}: {
402 buckets: ReadonlyArray<ResourceTelemetryHistoryBucket>;
403}) {
404 const maxCpu = resourceHistoryCpuScaleMax(buckets);
405 const maxIo = Math.max(1, ...buckets.map((bucket) => bucket.ioReadBytes + bucket.ioWriteBytes));
406
407 return (
408 <div className="border-t border-border/60 px-4 py-4 sm:px-5">
409 <div className="mb-3 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted-foreground/65">
410 <span className="inline-flex items-center gap-1.5">
411 <span className="h-1.5 w-3 rounded-full bg-foreground/70" /> CPU average
412 </span>
413 <span className="inline-flex items-center gap-1.5">
414 <span className="h-1.5 w-3 rounded-full bg-sky-500/70" /> I/O reads
415 </span>
416 <span className="inline-flex items-center gap-1.5">
417 <span className="h-1.5 w-3 rounded-full bg-amber-500/80" /> I/O writes
418 </span>
419 </div>
420 <div className="flex h-32 items-end gap-1 overflow-hidden rounded-lg border border-border/40 bg-muted/8 px-2 pt-3 pb-2">
421 {buckets.map((bucket) => {
422 const cpuHeight = resourceHistoryBarHeight({
423 value: bucket.avgCpuPercent,
424 max: maxCpu,
425 minimumVisiblePercent: 2,
426 });
427 const readHeight = resourceHistoryBarHeight({
428 value: bucket.ioReadBytes,
429 max: maxIo,
430 minimumVisiblePercent: 1,
431 });
432 const writeHeight = resourceHistoryBarHeight({
433 value: bucket.ioWriteBytes,
434 max: maxIo,
435 minimumVisiblePercent: 1,
436 });
437 return (
438 <Tooltip key={DateTime.formatIso(bucket.startedAt)}>
439 <TooltipTrigger
440 render={
441 <div className="grid h-full min-w-1 flex-1 grid-cols-3 items-end gap-px">
442 <span
443 className="block rounded-t-sm bg-foreground/65"
444 style={{ height: `${cpuHeight}%` }}
445 />
446 <span
447 className="block rounded-t-sm bg-sky-500/70"
448 style={{ height: `${readHeight}%` }}
449 />
450 <span
451 className="block rounded-t-sm bg-amber-500/80"
452 style={{ height: `${writeHeight}%` }}
453 />
454 </div>
455 }
456 />
457 <TooltipPopup side="top" className="space-y-0.5 text-left">
458 <div>CPU avg {bucket.avgCpuPercent.toFixed(1)}%</div>
459 <div>CPU peak {bucket.maxCpuPercent.toFixed(1)}%</div>
460 <div>Read {formatBytes(bucket.ioReadBytes)}</div>
461 <div>Write {formatBytes(bucket.ioWriteBytes)}</div>
462 </TooltipPopup>
463 </Tooltip>
464 );
465 })}
466 </div>
467 </div>
468 );
469}
470
471function ProcessTreeName({
472 process,
473 collapsed,
474 onToggle,
475}: {
476 process: ResourceTelemetryProcess;
477 collapsed: boolean;
478 onToggle: (process: ResourceTelemetryProcess) => void;
479}) {
480 const name = formatProcessName(process);
481 const hasChildren = process.childPids.length > 0;
482 const ChevronIcon = collapsed ? ChevronRightIcon : ChevronDownIcon;
483 return (
484 <div
485 className="grid min-w-0 grid-cols-[1.25rem_0.375rem_minmax(0,1fr)] items-center gap-2"
486 style={{ paddingLeft: `${Math.min(process.depth, 7) * 10}px` }}
487 >
488 {hasChildren ? (
489 <Button
490 size="icon-micro"
491 variant="ghost-muted"
492 onClick={() => onToggle(process)}
493 aria-label={collapsed ? `Expand ${name}` : `Collapse ${name}`}
494 >
495 <ChevronIcon className="size-3.5" />
496 </Button>
497 ) : (
498 <span className="size-5" aria-hidden />
499 )}
500 <span className={cn("size-1.5 rounded-full", categoryDotClass(process.category))} />
501 <Tooltip>
502 <TooltipTrigger
503 render={<span className="min-w-0 truncate font-medium text-foreground">{name}</span>}
504 />
505 <TooltipPopup
506 side="top"
507 className="max-w-[min(520px,calc(100vw-2rem))] whitespace-normal break-words text-left font-mono text-[11px]"
508 >
509 {process.command || process.name}
510 </TooltipPopup>
511 </Tooltip>
512 </div>
513 );
514}
515
516function canSignalProcess(process: ResourceTelemetryProcess): boolean {
517 return (
518 process.category === "server-child" ||
519 process.category === "provider-root" ||
520 process.category === "terminal-root"
521 );
522}
523
524function ProcessActions({
525 process,
526 signalingKeys,
527 onSignal,
528}: {
529 process: ResourceTelemetryProcess;
530 signalingKeys: ReadonlySet<string>;
531 onSignal: (process: ResourceTelemetryProcess, signal: ServerProcessSignal) => void;
532}) {
533 if (!canSignalProcess(process)) {
534 return <span className="text-[10px] text-muted-foreground/35">—</span>;
535 }
536 const isSignaling = signalingKeys.has(processIdentityKey(process));
537 return (
538 <div className="flex items-center justify-end gap-1.5">
539 <button
540 type="button"
541 disabled={isSignaling}
542 className="cursor-pointer text-[10px] font-semibold text-muted-foreground hover:text-foreground disabled:opacity-50"
543 onClick={() => onSignal(process, "SIGINT")}
544 >
545 INT
546 </button>
547 <button
548 type="button"
549 disabled={isSignaling}
550 className="cursor-pointer text-[10px] font-semibold text-destructive hover:underline disabled:opacity-50"
551 onClick={() => onSignal(process, "SIGKILL")}
552 >
553 KILL
554 </button>
555 </div>
556 );
557}
558
559function ProcessTable({
560 processes,
561 signalingKeys,
562 onSignal,
563}: {
564 processes: ReadonlyArray<ResourceTelemetryProcess>;
565 signalingKeys: ReadonlySet<string>;
566 onSignal: (process: ResourceTelemetryProcess, signal: ServerProcessSignal) => void;
567}) {
568 const [collapsed, setCollapsed] = useState<ReadonlySet<string>>(() => new Set());
569 const visible = useMemo(
570 () => visibleResourceTelemetryProcesses(processes, collapsed),
571 [collapsed, processes],
572 );
573 const toggle = useCallback((process: ResourceTelemetryProcess) => {
574 const identityKey = processIdentityKey(process);
575 setCollapsed((current) => {
576 const next = new Set(current);
577 if (next.has(identityKey)) {
578 next.delete(identityKey);
579 } else {
580 next.add(identityKey);
581 }
582 return next;
583 });
584 }, []);
585
586 return (
587 <ScrollArea
588 chainVerticalScroll
589 scrollFade
590 hideScrollbars
591 className="max-h-[min(68vh,48rem)] w-full max-w-full border-t border-border/60"
592 >
593 <table className="w-full min-w-[1320px] table-fixed text-left text-xs">
594 <colgroup>
595 <col className="w-[20%]" />
596 <col className="w-[10%]" />
597 <col className="w-[7%]" />
598 <col className="w-[8%]" />
599 <col className="w-[9%]" />
600 <col className="w-[9%]" />
601 <col className="w-[9%]" />
602 <col className="w-[10%]" />
603 <col className="w-[8%]" />
604 <col className="w-[6%]" />
605 <col className="w-[4%]" />
606 </colgroup>
607 <thead className="sticky top-0 z-10 border-b border-border/60 bg-card text-[10px] uppercase tracking-[0.08em] text-muted-foreground/65">
608 <tr>
609 <th className="px-4 py-2 font-semibold sm:pl-5">Process</th>
610 <th className="px-3 py-2 font-semibold">Category</th>
611 <th className="px-3 py-2 text-right font-semibold">CPU</th>
612 <th className="px-3 py-2 text-right font-semibold">CPU Time</th>
613 <th className="px-3 py-2 text-right font-semibold">Memory</th>
614 <th className="px-3 py-2 text-right font-semibold">Read/s</th>
615 <th className="px-3 py-2 text-right font-semibold">Write/s</th>
616 <th className="px-3 py-2 text-right font-semibold">Read Total</th>
617 <th className="px-3 py-2 text-right font-semibold">Write Total</th>
618 <th className="px-3 py-2 text-right font-semibold">PID</th>
619 <th className="px-2 py-2 text-right font-semibold sm:pr-4">Kill</th>
620 </tr>
621 </thead>
622 <tbody className="divide-y divide-border/50">
623 {visible.length === 0 ? (
624 <tr>
625 <td colSpan={11} className="px-4 py-5 text-xs text-muted-foreground sm:px-5">
626 Waiting for the native process monitor.
627 </td>
628 </tr>
629 ) : null}
630 {visible.map((process) => (
631 <tr key={processIdentityKey(process)} className="hover:bg-muted/20">
632 <td className="px-4 py-2 sm:pl-5">
633 <ProcessTreeName
634 process={process}
635 collapsed={collapsed.has(processIdentityKey(process))}
636 onToggle={toggle}
637 />
638 </td>
639 <td className="truncate px-3 py-2 text-[11px] text-muted-foreground">
640 {categoryLabel(process.category)}
641 </td>
642 <td className="px-3 py-2 text-right font-mono tabular-nums">
643 {process.cpuPercent.toFixed(1)}%
644 </td>
645 <td className="px-3 py-2 text-right font-mono tabular-nums">
646 {formatCpuTime(process.cpuTimeMs)}
647 </td>
648 <td className="px-3 py-2 text-right font-mono tabular-nums">
649 {formatBytes(process.residentBytes)}
650 </td>
651 <td className="px-3 py-2 text-right font-mono tabular-nums text-sky-700 dark:text-sky-300">
652 {formatRate(process.ioReadBytesPerSecond)}
653 </td>
654 <td className="px-3 py-2 text-right font-mono tabular-nums text-amber-700 dark:text-amber-300">
655 {formatRate(process.ioWriteBytesPerSecond)}
656 </td>
657 <td className="px-3 py-2 text-right font-mono tabular-nums text-muted-foreground">
658 {formatBytes(process.ioReadBytes)}
659 </td>
660 <td className="px-3 py-2 text-right font-mono tabular-nums text-muted-foreground">
661 <Tooltip>
662 <TooltipTrigger render={<span>{formatBytes(process.ioWriteBytes)}</span>} />
663 <TooltipPopup side="top">{ioSemanticsLabel(process.ioSemantics)}</TooltipPopup>
664 </Tooltip>
665 </td>
666 <td className="px-3 py-2 text-right font-mono tabular-nums text-muted-foreground">
667 {process.identity.pid}
668 </td>
669 <td className="px-2 py-2 text-right sm:pr-4">
670 <ProcessActions
671 process={process}
672 signalingKeys={signalingKeys}
673 onSignal={onSignal}
674 />
675 </td>
676 </tr>
677 ))}
678 </tbody>
679 </table>
680 </ScrollArea>
681 );
682}
683
684function HistoryProcessTable({
685 processes,
686}: {
687 processes: ReadonlyArray<ResourceTelemetryProcessSummary>;
688}) {
689 return (
690 <ScrollArea
691 chainVerticalScroll
692 scrollFade
693 hideScrollbars
694 className="max-h-[28rem] w-full max-w-full border-t border-border/60"
695 >
696 <table className="w-full min-w-[1020px] table-fixed text-left text-xs">
697 <colgroup>
698 <col className="w-[24%]" />
699 <col className="w-[11%]" />
700 <col className="w-[10%]" />
701 <col className="w-[10%]" />
702 <col className="w-[11%]" />
703 <col className="w-[11%]" />
704 <col className="w-[11%]" />
705 <col className="w-[7%]" />
706 <col className="w-[5%]" />
707 </colgroup>
708 <thead className="sticky top-0 z-10 border-b border-border/60 bg-card text-[10px] uppercase tracking-[0.08em] text-muted-foreground/65">
709 <tr>
710 <th className="px-4 py-2 font-semibold sm:pl-5">Process</th>
711 <th className="px-3 py-2 font-semibold">Category</th>
712 <th className="px-3 py-2 text-right font-semibold">CPU Time</th>
713 <th className="px-3 py-2 text-right font-semibold">Peak CPU</th>
714 <th className="px-3 py-2 text-right font-semibold">Peak Mem</th>
715 <th className="px-3 py-2 text-right font-semibold">Read</th>
716 <th className="px-3 py-2 text-right font-semibold">Write</th>
717 <th className="px-3 py-2 text-right font-semibold">Samples</th>
718 <th className="px-3 py-2 text-right font-semibold sm:pr-5">PID</th>
719 </tr>
720 </thead>
721 <tbody className="divide-y divide-border/50">
722 {processes.length === 0 ? (
723 <tr>
724 <td colSpan={9} className="px-4 py-5 text-xs text-muted-foreground sm:px-5">
725 No retained process samples in this window.
726 </td>
727 </tr>
728 ) : null}
729 {processes.map((process) => (
730 <tr key={processSummaryIdentityKey(process)} className="hover:bg-muted/20">
731 <td className="px-4 py-2 sm:pl-5">
732 <Tooltip>
733 <TooltipTrigger
734 render={
735 <span className="block truncate font-medium text-foreground">
736 {process.name || process.command}
737 </span>
738 }
739 />
740 <TooltipPopup
741 side="top"
742 className="max-w-[min(520px,calc(100vw-2rem))] whitespace-normal break-words text-left font-mono text-[11px]"
743 >
744 {process.command || process.name}
745 </TooltipPopup>
746 </Tooltip>
747 </td>
748 <td className="truncate px-3 py-2 text-[11px] text-muted-foreground">
749 {categoryLabel(process.category)}
750 </td>
751 <td className="px-3 py-2 text-right font-mono tabular-nums">
752 {formatCpuTime(process.cpuTimeMs)}
753 </td>
754 <td className="px-3 py-2 text-right font-mono tabular-nums">
755 {process.maxCpuPercent.toFixed(1)}%
756 </td>
757 <td className="px-3 py-2 text-right font-mono tabular-nums">
758 {formatBytes(process.peakRssBytes)}
759 </td>
760 <td className="px-3 py-2 text-right font-mono tabular-nums text-sky-700 dark:text-sky-300">
761 {formatBytes(process.ioReadBytes)}
762 </td>
763 <td className="px-3 py-2 text-right font-mono tabular-nums text-amber-700 dark:text-amber-300">
764 {formatBytes(process.ioWriteBytes)}
765 </td>
766 <td className="px-3 py-2 text-right font-mono tabular-nums text-muted-foreground">
767 {process.sampleCount}
768 </td>
769 <td className="px-3 py-2 text-right font-mono tabular-nums text-muted-foreground sm:pr-5">
770 {process.identity.pid}
771 </td>
772 </tr>
773 ))}
774 </tbody>
775 </table>
776 </ScrollArea>
777 );
778}
779
780function AttributionTable({ entries }: { entries: ReadonlyArray<ResourceAttributionEntry> }) {
781 return (
782 <div className="overflow-x-auto border-t border-border/60">
783 <table className="w-full min-w-[720px] table-fixed text-left text-xs">
784 <colgroup>
785 <col className="w-[22%]" />
786 <col className="w-[28%]" />
787 <col className="w-[14%]" />
788 <col className="w-[14%]" />
789 <col className="w-[10%]" />
790 <col className="w-[12%]" />
791 </colgroup>
792 <thead className="border-b border-border/60 text-[10px] uppercase tracking-[0.08em] text-muted-foreground/65">
793 <tr>
794 <th className="px-4 py-2 font-semibold sm:pl-5">Component</th>
795 <th className="px-3 py-2 font-semibold">Operation</th>
796 <th className="px-3 py-2 text-right font-semibold">Logical Read</th>
797 <th className="px-3 py-2 text-right font-semibold">Logical Write</th>
798 <th className="px-3 py-2 text-right font-semibold">Count</th>
799 <th className="px-3 py-2 text-right font-semibold sm:pr-5">Time</th>
800 </tr>
801 </thead>
802 <tbody className="divide-y divide-border/50">
803 {entries.length === 0 ? (
804 <tr>
805 <td colSpan={6} className="px-4 py-5 text-xs text-muted-foreground sm:px-5">
806 No instrumented application I/O has been recorded yet.
807 </td>
808 </tr>
809 ) : null}
810 {entries.map((entry) => (
811 <tr key={`${entry.component}:${entry.operation}`} className="hover:bg-muted/20">
812 <td className="truncate px-4 py-2 font-medium text-foreground sm:pl-5">
813 {entry.component}
814 </td>
815 <td className="truncate px-3 py-2 text-muted-foreground">{entry.operation}</td>
816 <td className="px-3 py-2 text-right font-mono tabular-nums text-sky-700 dark:text-sky-300">
817 {formatBytes(entry.logicalReadBytes)}
818 </td>
819 <td className="px-3 py-2 text-right font-mono tabular-nums text-amber-700 dark:text-amber-300">
820 {formatBytes(entry.logicalWriteBytes)}
821 </td>
822 <td className="px-3 py-2 text-right font-mono tabular-nums">{entry.count}</td>
823 <td className="px-3 py-2 text-right font-mono tabular-nums text-muted-foreground sm:pr-5">
824 {(entry.durationMs / 1_000).toFixed(2)}s
825 </td>
826 </tr>
827 ))}
828 </tbody>
829 </table>
830 </div>
831 );
832}
833
834export function ResourceTelemetryDiagnostics() {
835 const [windowMs, setWindowMs] = useState(15 * 60_000);
836 const selectedWindow =
837 HISTORY_WINDOWS.find((option) => option.windowMs === windowMs) ?? HISTORY_WINDOWS[1];
838 const telemetry = useResourceTelemetry();
839 const retryTelemetry = telemetry.retry;
840 const history = useResourceTelemetryHistory({
841 windowMs: selectedWindow.windowMs,
842 bucketMs: selectedWindow.bucketMs,
843 });
844 const primaryEnvironment = usePrimaryEnvironment();
845 const signalServerProcess = useAtomCommand(serverEnvironment.signalProcess, {
846 reportFailure: false,
847 });
848 const [signalingKeys, setSignalingKeys] = useState<ReadonlySet<string>>(() => new Set());
849 const signalingKeysRef = useRef<ReadonlySet<string>>(new Set());
850 signalingKeysRef.current = signalingKeys;
851 const primaryEnvironmentIdRef = useRef(primaryEnvironment?.environmentId);
852 primaryEnvironmentIdRef.current = primaryEnvironment?.environmentId;
853 const [isRetrying, setIsRetrying] = useState(false);
854 const snapshot = telemetry.data;
855 const allT3 = snapshot?.groups.allT3;
856
857 const signalProcess = useCallback(
858 async (process: ResourceTelemetryProcess, signal: ServerProcessSignal) => {
859 const identityKey = processIdentityKey(process);
860 if (signalingKeysRef.current.has(identityKey)) return;
861 const nextSignalingKeys = new Set(signalingKeysRef.current).add(identityKey);
862 signalingKeysRef.current = nextSignalingKeys;
863 setSignalingKeys(nextSignalingKeys);
864 const clearSignaling = () => {
865 const next = new Set(signalingKeysRef.current);
866 next.delete(identityKey);
867 signalingKeysRef.current = next;
868 setSignalingKeys(next);
869 };
870
871 if (signal === "SIGKILL") {
872 let confirmed = false;
873 try {
874 confirmed = await ensureLocalApi().dialogs.confirm(
875 `Send SIGKILL to process ${process.identity.pid}? This cannot be handled by the process.`,
876 { variant: "destructive" },
877 );
878 } catch (error) {
879 clearSignaling();
880 toastManager.add({
881 type: "error",
882 title: "Could not confirm signal",
883 description: error instanceof Error ? error.message : `Failed to send ${signal}.`,
884 });
885 return;
886 }
887 if (!confirmed) {
888 clearSignaling();
889 return;
890 }
891 }
892 const environmentId = primaryEnvironmentIdRef.current;
893 if (environmentId === undefined) {
894 clearSignaling();
895 return;
896 }
897 void signalServerProcess({
898 environmentId,
899 input: {
900 pid: process.identity.pid,
901 startTimeMs: process.identity.startTimeMs,
902 signal,
903 },
904 })
905 .then((result) => {
906 if (result._tag === "Failure") {
907 if (isAtomCommandInterrupted(result)) return;
908 throw squashAtomCommandFailure(result);
909 }
910 if (result.value.signaled) return;
911 toastManager.add({
912 type: "error",
913 title: `Could not send ${signal}`,
914 description: Option.getOrElse(
915 result.value.message,
916 () => `Failed to send ${signal} to process ${process.identity.pid}.`,
917 ),
918 });
919 })
920 .catch((error: unknown) => {
921 toastManager.add({
922 type: "error",
923 title: `Could not send ${signal}`,
924 description: error instanceof Error ? error.message : `Failed to send ${signal}.`,
925 });
926 })
927 .finally(() => {
928 clearSignaling();
929 });
930 },
931 [signalServerProcess],
932 );
933
934 const retryCollector = useCallback(() => {
935 setIsRetrying(true);
936 void retryTelemetry()
937 .catch((error: unknown) => {
938 toastManager.add({
939 type: "error",
940 title: "Could not restart resource monitor",
941 description:
942 error instanceof Error ? error.message : "The resource monitor retry failed.",
943 });
944 })
945 .finally(() => {
946 setIsRetrying(false);
947 });
948 }, [retryTelemetry]);
949
950 const speedLimit = snapshot ? Option.getOrNull(snapshot.speedLimitPercent) : null;
951 const collectorNeedsRetry = shouldShowResourceMonitorRetry({
952 nativeStatus: snapshot?.health.native.status ?? null,
953 error: telemetry.error,
954 });
955 const hasHostPowerSignal =
956 snapshot !== null &&
957 (snapshot.power.onBattery !== "unknown" ||
958 snapshot.power.lowPowerMode !== "unknown" ||
959 snapshot.power.idle !== "unknown" ||
960 snapshot.power.locked !== "unknown" ||
961 snapshot.power.thermalState !== "unknown");
962
963 return (
964 <>
965 <SettingsSection
966 title="Resource monitor"
967 icon={<ActivityIcon className="size-4 text-muted-foreground" />}
968 headerAction={
969 <div className="flex items-center gap-2">
970 {snapshot ? (
971 <SourceStatusBadge label="Native" status={snapshot.health.native.status} />
972 ) : null}
973 <LastSampleLabel sampledAt={snapshot?.readAt ?? null} />
974 <Tooltip>
975 <TooltipTrigger
976 render={
977 <Button
978 size="icon-micro"
979 variant="ghost"
980 disabled={telemetry.isPending}
981 onClick={telemetry.refresh}
982 aria-label="Refresh resource telemetry"
983 >
984 <RefreshCwIcon
985 className={cn("size-3", telemetry.isPending && "animate-spin")}
986 />
987 </Button>
988 }
989 />
990 <TooltipPopup side="top">Refresh telemetry snapshot</TooltipPopup>
991 </Tooltip>
992 </div>
993 }
994 >
995 <div className="overflow-hidden rounded-2xl border border-border/70 bg-card shadow-[0_1px_1px_rgb(0_0_0/0.03),0_8px_30px_rgb(0_0_0/0.035)]">
996 <div className="flex flex-col gap-3 border-b border-border/60 bg-linear-to-r from-muted/45 via-muted/20 to-transparent px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-5">
997 <div>
998 <div className="text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground/70">
999 T3 system footprint
1000 </div>
1001 <p className="mt-1 max-w-xl text-xs leading-relaxed text-muted-foreground">
1002 Live native counters for the server, providers, terminals, desktop processes, and
1003 the monitor itself.
1004 </p>
1005 </div>
1006 <div className="flex items-center gap-2 text-[10px] text-muted-foreground/65">
1007 <span className="size-1.5 rounded-full bg-emerald-500" />
1008 Sampling every {snapshot ? formatSampleInterval(snapshot.sampleIntervalMs) : "..."}
1009 </div>
1010 </div>
1011 <div className="grid grid-cols-2 divide-x divide-y divide-border/55 md:grid-cols-3">
1012 <IconStat
1013 icon={<CpuIcon className="size-3.5" />}
1014 label="Current CPU"
1015 value={allT3 ? `${allT3.currentCpuPercent.toFixed(1)}%` : "..."}
1016 detail={allT3 ? `${formatCpuTime(allT3.cpuTimeMs)} observed CPU time` : undefined}
1017 />
1018 <IconStat
1019 icon={<MemoryStickIcon className="size-3.5" />}
1020 label="Resident memory"
1021 value={allT3 ? formatBytes(allT3.currentRssBytes) : "..."}
1022 detail={
1023 allT3 ? `${formatBytes(allT3.peakRssBytes)} combined process peaks` : undefined
1024 }
1025 />
1026 <IconStat
1027 icon={<ActivityIcon className="size-3.5" />}
1028 label="Process count"
1029 value={allT3 ? String(allT3.processCount) : "..."}
1030 detail={
1031 allT3 ? `${allT3.processStarts} starts · ${allT3.processExits} exits` : undefined
1032 }
1033 />
1034 <IconStat
1035 icon={<HardDriveIcon className="size-3.5" />}
1036 label="Read throughput"
1037 value={allT3 ? formatRate(allT3.ioReadBytesPerSecond) : "..."}
1038 detail={allT3 ? `${formatBytes(allT3.ioReadBytes)} observed` : undefined}
1039 />
1040 <IconStat
1041 icon={<DatabaseIcon className="size-3.5" />}
1042 label="Write throughput"
1043 value={allT3 ? formatRate(allT3.ioWriteBytesPerSecond) : "..."}
1044 detail={allT3 ? `${formatBytes(allT3.ioWriteBytes)} observed` : undefined}
1045 tone={
1046 allT3 && allT3.ioWriteBytesPerSecond >= 10 * 1_024 * 1_024
1047 ? "danger"
1048 : allT3 && allT3.ioWriteBytesPerSecond >= 1_024 * 1_024
1049 ? "warning"
1050 : "default"
1051 }
1052 />
1053 <IconStat
1054 icon={<GaugeIcon className="size-3.5" />}
1055 label="CPU speed limit"
1056 value={
1057 snapshot ? (speedLimit === null ? "Unknown" : `${speedLimit.toFixed(0)}%`) : "..."
1058 }
1059 detail={snapshot ? `${snapshot.power.thermalState} thermal state` : undefined}
1060 tone={speedLimit !== null && speedLimit < 80 ? "warning" : "default"}
1061 />
1062 </div>
1063 {telemetry.error ? (
1064 <div className="flex items-start gap-2 border-t border-destructive/20 bg-destructive/5 px-4 py-3 text-xs text-destructive sm:px-5">
1065 <AlertTriangleIcon className="mt-0.5 size-3.5 shrink-0" />
1066 <span>{telemetry.error}</span>
1067 </div>
1068 ) : null}
1069 {snapshot ? (
1070 <div className="grid border-t border-border/60 bg-muted/10 md:grid-cols-3">
1071 <AggregateCard
1072 label="Backend + agents"
1073 accentClass="bg-emerald-500/80"
1074 aggregate={snapshot.groups.backend}
1075 />
1076 <AggregateCard
1077 label="Desktop"
1078 accentClass="bg-sky-500/80"
1079 aggregate={snapshot.groups.electron}
1080 />
1081 <AggregateCard
1082 label="Monitor overhead"
1083 accentClass="bg-amber-500/80"
1084 aggregate={snapshot.groups.monitor}
1085 />
1086 </div>
1087 ) : null}
1088 </div>
1089 </SettingsSection>
1090
1091 <SettingsSection
1092 title="Host & collection"
1093 icon={<GaugeIcon className="size-4 text-muted-foreground" />}
1094 headerAction={
1095 collectorNeedsRetry ? (
1096 <Button size="xs" variant="outline" disabled={isRetrying} onClick={retryCollector}>
1097 <RotateCcwIcon className={cn("size-3", isRetrying && "animate-spin")} />
1098 Retry monitor
1099 </Button>
1100 ) : null
1101 }
1102 >
1103 <div className="grid overflow-hidden rounded-2xl border border-border/70 bg-card shadow-[0_1px_1px_rgb(0_0_0/0.03)] md:grid-cols-2 md:divide-x md:divide-border/60">
1104 <div className="px-4 py-4 sm:px-5">
1105 <div className="mb-3 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70">
1106 <span className="flex size-6 items-center justify-center rounded-md bg-muted/60">
1107 <BatteryIcon className="size-3.5" />
1108 </span>
1109 Host state
1110 </div>
1111 {hasHostPowerSignal && snapshot ? (
1112 <>
1113 <DetailRow
1114 label="Power source"
1115 value={booleanStateLabel(snapshot.power.onBattery, {
1116 true: "Battery",
1117 false: "External power",
1118 })}
1119 />
1120 <DetailRow
1121 label="Low power mode"
1122 value={booleanStateLabel(snapshot.power.lowPowerMode, {
1123 true: "Enabled",
1124 false: "Disabled",
1125 })}
1126 />
1127 <DetailRow
1128 label="Idle"
1129 value={`${booleanStateLabel(snapshot.power.idle, {
1130 true: "Idle",
1131 false: "Active",
1132 })}${
1133 snapshot.power.idleSeconds === null
1134 ? ""
1135 : ` · ${Math.round(snapshot.power.idleSeconds)}s`
1136 }`}
1137 />
1138 <DetailRow
1139 label="Session"
1140 value={
1141 snapshot.power.suspended
1142 ? "Suspended"
1143 : booleanStateLabel(snapshot.power.locked, {
1144 true: "Locked",
1145 false: "Unlocked",
1146 })
1147 }
1148 />
1149 <DetailRow
1150 label="Thermal"
1151 value={snapshot.power.thermalState}
1152 valueClassName={
1153 snapshot.power.thermalState === "serious" ||
1154 snapshot.power.thermalState === "critical"
1155 ? "text-destructive"
1156 : undefined
1157 }
1158 />
1159 </>
1160 ) : (
1161 <div className="rounded-xl border border-dashed border-border/70 bg-muted/20 px-4 py-5">
1162 <div className="text-[13px] font-medium text-foreground">
1163 Desktop host signals not connected
1164 </div>
1165 <p className="mt-1.5 max-w-sm text-[11px] leading-relaxed text-muted-foreground/70">
1166 Power, idle, lock, and thermal state are supplied by the desktop host. Process
1167 telemetry remains fully active in this browser session.
1168 </p>
1169 </div>
1170 )}
1171 </div>
1172 <div className="border-t border-border/60 px-4 py-4 md:border-t-0 sm:px-5">
1173 <div className="mb-3 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70">
1174 <span className="flex size-6 items-center justify-center rounded-md bg-muted/60">
1175 <GaugeIcon className="size-3.5" />
1176 </span>
1177 Collection health
1178 </div>
1179 {snapshot ? (
1180 <>
1181 <HealthSource label="Native process monitor" health={snapshot.health.native} />
1182 <HealthSource label="Electron main process" health={snapshot.health.desktop} />
1183 <DetailRow
1184 label="Collection time"
1185 value={formatDurationMicros(snapshot.health.collectionDurationMicros)}
1186 />
1187 <DetailRow
1188 label="Process scan"
1189 value={`${snapshot.health.retainedProcessCount}/${snapshot.health.scannedProcessCount} retained`}
1190 />
1191 <DetailRow
1192 label="Inaccessible"
1193 value={String(snapshot.health.inaccessibleProcessCount)}
1194 valueClassName={
1195 snapshot.health.inaccessibleProcessCount > 0
1196 ? "text-amber-600 dark:text-amber-300"
1197 : undefined
1198 }
1199 />
1200 <DetailRow
1201 label="Sidecar"
1202 value={Option.match(snapshot.health.sidecarVersion, {
1203 onNone: () => "Unavailable",
1204 onSome: (version) =>
1205 `${version}${Option.match(snapshot.health.sidecarPid, {
1206 onNone: () => "",
1207 onSome: (pid) => ` · PID ${pid}`,
1208 })}`,
1209 })}
1210 />
1211 <DetailRow label="Restarts" value={String(snapshot.health.restartCount)} />
1212 </>
1213 ) : (
1214 <div className="py-4 text-xs text-muted-foreground">
1215 Waiting for collector health.
1216 </div>
1217 )}
1218 </div>
1219 </div>
1220 </SettingsSection>
1221
1222 <SettingsSection
1223 title="Resource timeline"
1224 icon={<HardDriveIcon className="size-4 text-muted-foreground" />}
1225 headerAction={
1226 <div className="flex items-center gap-2">
1227 <HistoryWindowSelector selectedWindowMs={windowMs} onSelect={setWindowMs} />
1228 <Button
1229 size="icon-micro"
1230 variant="ghost"
1231 disabled={history.isPending}
1232 onClick={history.refresh}
1233 aria-label="Refresh resource history"
1234 >
1235 <RefreshCwIcon className={cn("size-3", history.isPending && "animate-spin")} />
1236 </Button>
1237 </div>
1238 }
1239 >
1240 <div className="overflow-hidden rounded-2xl border border-border/70 bg-card shadow-[0_1px_1px_rgb(0_0_0/0.03)]">
1241 {history.error ? (
1242 <div className="flex items-start gap-2 border-b border-destructive/20 bg-destructive/5 px-4 py-3 text-xs text-destructive sm:px-5">
1243 <AlertTriangleIcon className="mt-0.5 size-3.5 shrink-0" />
1244 <span>{history.error}</span>
1245 </div>
1246 ) : null}
1247 <ResourceHistoryChart buckets={history.data?.buckets ?? []} />
1248 <HistoryProcessTable processes={history.data?.topProcesses ?? []} />
1249 </div>
1250 </SettingsSection>
1251
1252 <SettingsSection
1253 title="Live process tree"
1254 icon={<CpuIcon className="size-4 text-muted-foreground" />}
1255 headerAction={
1256 snapshot ? (
1257 <span className="text-[10px] text-muted-foreground/55">
1258 Identity: <span className="font-mono">PID + start time</span>
1259 </span>
1260 ) : null
1261 }
1262 >
1263 <div className="overflow-hidden rounded-2xl border border-border/70 bg-card shadow-[0_1px_1px_rgb(0_0_0/0.03)]">
1264 <ProcessTable
1265 processes={snapshot?.processes ?? []}
1266 signalingKeys={signalingKeys}
1267 onSignal={signalProcess}
1268 />
1269 </div>
1270 </SettingsSection>
1271
1272 <SettingsSection
1273 title="Instrumented application I/O"
1274 icon={<DatabaseIcon className="size-4 text-muted-foreground" />}
1275 headerAction={
1276 <span className="text-[10px] text-muted-foreground/55">Logical bytes by operation</span>
1277 }
1278 >
1279 <div className="overflow-hidden rounded-2xl border border-border/70 bg-card shadow-[0_1px_1px_rgb(0_0_0/0.03)]">
1280 <div className="bg-muted/15 px-4 py-3 text-[11px] leading-relaxed text-muted-foreground sm:px-5">
1281 Native counters identify which process is reading or writing. These application-level
1282 counters identify known T3 operations so process spikes can be correlated with specific
1283 persistence and logging paths.
1284 </div>
1285 <AttributionTable entries={snapshot?.attribution.entries ?? []} />
1286 </div>
1287 </SettingsSection>
1288 </>
1289 );
1290}