feat(host): populate sysinfo and cpuinfo on macOS (VA-133) #133
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/VA-133-macos-sysinfo-cpuinfo"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Populates the agent Overview on macOS nodes.
host::sysinfoandhost::cpuinfoboth had acfg(not(target_os = "linux"))stub returning a default snapshot, so on a Mac the console showed OS-, Kernel-, CPU0 threads, Memory-, Uptime-, and Load-. This adds macOS backends that read the same facts viasysctlandvm_stat.cpuinfo
snapshot()gains a macOS arm readinghw.logicalcpu,machdep.cpu.brand_string,machdep.cpu.vendor, andhw.cpufrequency. The raw-to-CpuInfomapping is a purecpuinfo_from_sysctl()so it is unit-tested off-macOS.hw.cpufrequencyis absent on Apple Silicon; a missing or zero value is reported as unknown rather than 0 MHz.cache_sizehas no clean single-key sysctl equivalent and is leftNone.sysinfo
snapshot()gains a macOS arm readingkern.osrelease(kernel),kern.boottime(uptime = now - boottime),vm.loadavg(load averages),hw.memsize(total memory), andvm_stat(available memory, estimated as free + inactive + speculative + purgeable pages times page size, matching what Activity Monitor treats as reclaimable). Each BSD-format source is parsed by a pure helper (parse_boottime_secs,parse_loadavg_bsd,parse_vm_stat_available) with Linux-runnable unit tests; the thinsysctl/vm_statshells are macOS-gated.Testing
The pure parsers are gated
cfg(any(target_os = "macos", test))so they compile and run underteston Linux. 21 lib tests forhost::cpuinfo+host::sysinfopass; clippy--deny warningsand fmt are clean on Linux.The macOS-only process shells (
sysctl_str,vm_stat_output,snapshot_macos) cannot be compiled on the Linux dev box (no Apple SDK for the C deps), so a nativecargo build --release --target x86_64-apple-darwinplus an Overview check on a Mac node is still needed to confirm the live values render. Linux and other-platform paths are unchanged.Closes VA-133.