Files
Dario Gabriel LipicarandClaude Opus 5 1774063e4b fix(host-core): read the stats keys process-stats actually emits
logos_host_core.h's stats parser read "cpu" and "memory". The only producer,
process-stats/src/process_stats.cpp:157-161, emits:

    name, cpu_percent, cpu_time_seconds, memory_mb

So ModuleStats::cpuPercent and ::memoryBytes were permanently 0 for every
module. memoryBytes was doubly wrong: ProcessStatsData::memoryMB is a double in
MEGABYTES, so the member both misnamed the unit and modelled the wrong type.

Now reads the real keys, renames memoryBytes -> memoryMb (double), and models
cpu_time_seconds, which was previously reachable only through `raw`.

WHY THIS SURVIVED. tests/sdk/test_logos_host_core.cpp stubs
logos_core_get_module_stats() itself, and stubbed it as {"cpu":..,"memory":..} —
keys nothing produces. The test asserted the parser's bug against a fixture
built to match it, so it was green and would have stayed green. The stub is now
derived from process_stats.cpp instead.

This matters because the façade has no production consumers yet: the first host
to adopt it would have silently reported 0.0% CPU and 0.0 MB for every module.
logos-basecamp's hand-rolled parser, which this was meant to replace, reads
cpu_percent with a cpu fallback and memory_mb with memory/memory_MB fallbacks —
it was already both correct and version-tolerant.

logos-qt-sdk's veneer mirrors these fields into a QVariantMap and needs the
matching change; it is a separate PR and must land AFTER this one.

checks.tests passes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 17:02:12 -03:00
..