#pragma once #include namespace fgc::hostmetrics { // Host (LattePanda / Linux) health reads for the `test host` subsystem. Pure // parsers are split from the live readers so they unit-test without a real /sys // or /proc. All readers degrade gracefully (ok=false) rather than throw. struct ThermalInfo { bool ok = false; double max_temp_c = 0.0; // hottest thermal zone std::string hottest_zone; // e.g. "x86_pkg_temp" bool throttled = false; // best-effort (false if unknown) }; struct DiskInfo { bool ok = false; std::string path; double total_gb = 0.0; double free_gb = 0.0; double used_pct = 0.0; }; struct MemInfo { bool ok = false; double total_mb = 0.0; double avail_mb = 0.0; double swap_used_mb = 0.0; }; struct LoadInfo { bool ok = false; double load1 = 0.0, load5 = 0.0, load15 = 0.0; int cpus = 0; }; // ---- live readers ---- ThermalInfo readThermal(); // scans /sys/class/thermal DiskInfo readDisk(const std::string& path); // statvfs() on the filesystem holding `path` MemInfo readMeminfo(); // /proc/meminfo LoadInfo readLoad(); // getloadavg() + nproc // ---- pure parsers (reused by the readers; exposed for tests) ---- MemInfo parseMeminfo(const std::string& proc_meminfo); double parseMilliCelsius(const std::string& zone_temp_contents); // "52000\n" -> 52.0 } // namespace fgc::hostmetrics