(hardware: HardwareSnapshot)
| 315 | |
| 316 | |
| 317 | def _format_cpu_memory(hardware: HardwareSnapshot) -> list[str]: |
| 318 | lines = [] |
| 319 | if _has_field(hardware, "cpu"): |
| 320 | cpu = hardware.cpu |
| 321 | brand = _optional_string(cpu, "brand") |
| 322 | lines.append(_result_line(True, "CPU", brand) if brand else _missing_line("CPU")) |
| 323 | core_parts = [] |
| 324 | if _has_field(cpu, "logical_count"): |
| 325 | core_parts.append(f"{cpu.logical_count} logical") |
| 326 | if _has_field(cpu, "physical_count"): |
| 327 | core_parts.append(f"{cpu.physical_count} physical") |
| 328 | lines.append( |
| 329 | _result_line(True, "CPU Cores", " / ".join(core_parts)) if core_parts else _missing_line("CPU Cores") |
| 330 | ) |
| 331 | else: |
| 332 | lines.append(_missing_line("CPU", "Not collected")) |
| 333 | lines.append(_missing_line("CPU Cores", "Not collected")) |
| 334 | |
| 335 | if _has_field(hardware, "memory"): |
| 336 | memory = _format_memory(hardware.memory, "total", "total_unit") |
| 337 | lines.append(_result_line(True, "Memory", memory) if memory else _missing_line("Memory")) |
| 338 | else: |
| 339 | lines.append(_missing_line("Memory", "Not collected")) |
| 340 | return lines |
| 341 | |
| 342 | |
| 343 | def _format_accelerators(hardware: HardwareSnapshot) -> list[str]: |
no test coverage detected
searching dependent graphs…