(value: number | null | undefined, unit: ProcessCpuUnit | undefined)
| 2 | import { countedDetail, repeatCount } from '../app/ui-log'; |
| 3 | |
| 4 | export function cpuText(value: number | null | undefined, unit: ProcessCpuUnit | undefined): string { |
| 5 | if (value == null || !Number.isFinite(value) || value < 0) return 'Unavailable'; |
| 6 | if (unit === 'percent') return `${value.toFixed(1)}%`; |
| 7 | if (unit === 'seconds') return `${value.toFixed(1)} s total`; |
| 8 | return 'Unit unavailable'; |
| 9 | } |
| 10 | |
| 11 | export function memoryText(value: number | null | undefined): string { |
| 12 | return value == null || !Number.isFinite(value) || value < 0 ? 'Unavailable' : `${value.toFixed(1)} MiB`; |
no outgoing calls
no test coverage detected