File
Blob: worker/src/client/exhibit/board/core-meter.tsx
| 1 | export function CoreMeter({ |
| 2 | core, |
| 3 | task, |
| 4 | busyBps, |
| 5 | }: { |
| 6 | core: 0 | 1; |
| 7 | task: string; |
| 8 | busyBps?: number | null; |
| 9 | }) { |
| 10 | const known = busyBps !== undefined && busyBps !== null; |
| 11 | return ( |
| 12 | <div className="py-1.5"> |
| 13 | <div className="flex items-center justify-between gap-2"> |
| 14 | <span className="rounded bg-core px-1.5 py-1 font-mono text-[8px] tracking-wide"> |
| 15 | CORE {core} |
| 16 | </span> |
| 17 | <span |
| 18 | className="w-[5ch] text-right font-mono text-[10px] text-muted" |
| 19 | data-testid={`cpu-${core}`} |
| 20 | > |
| 21 | {known ? `${Math.round(busyBps / 100)}%` : '––'} |
| 22 | </span> |
| 23 | </div> |
| 24 | <div className="mt-1 text-[11px]">{task}</div> |
| 25 | <div className="mt-1.5 h-[3px] overflow-hidden rounded bg-core" aria-hidden="true"> |
| 26 | <span |
| 27 | className="block size-full origin-left bg-spectrum" |
| 28 | style={{ transform: `scaleX(${known ? busyBps / 10000 : 0})` }} |
| 29 | /> |
| 30 | </div> |
| 31 | </div> |
| 32 | ); |
| 33 | } |