code wiki / _hdl_build / nx_resmon.nx

nx_resmon.nx

buildroot/runtime/_hdl_build/nx_resmon.nx

7449 B134 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_resmon.nx -- the RESOURCE axis the health plane never had (debt seq897 / seq1005). WHY THIS EXISTS: on 2026-07-25 nx_health returned {overall:OK, degraded:0, down:0} while the box was at 93.4% swap exhaustion with nr_vmscan_immediate_reclaim 1.33e9 -- sustained thrash. The health plane probes GATEWAYS ONLY, so the single most destabilising condition on the platform was invisible to every instrument we owned. LAW: an instrument that reports OK during the worst outage class it could ever see is not an instrument. TWO AXES: A. PRESSURE -- swap consumed / memory available. A LAGGING indicator: by the time it is red the box is already thrashing. B. LEAK CENSUS -- processes whose VmSize == VmPeak above a COMMITTED-memory floor. A LEADING indicator: it fires while swap is still healthy. This is the fingerprint that identified the leaking organs in the first place. This organ owns the /proc walk and the printing ONLY. Both policy predicates live in nx_resmon_lib.nx so the gate exercises the SAME code this runs (rule 9 single responsibility, rule 15 DRY). Thresholds are data-driven from knowledge/status/resmon.conf (rule 11). Read-only. Exit code IS the verdict so a caller can gate on it: 0=GREEN 1=AMBER 2=RED. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_resmon_lib.nx nx_proc_ctl.nx nx_resmon.nx

imports: nx_resmon_lib.nxnx_proc_ctl.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main rm_read sys_openat_rd sys_read sys_close rm_conf rm_field rm_slen rm_field ↻ sys_getdents64 dirent_reclen dirent_name rm_is_leaker rm_verdict rm_puts sys_write rm_slen ↻ rm_num sys_mmap rm_puts ↻ sys_munmap

structs

none

consts

24const RM_MAGIC_262144: i64 = 262144
26const RM_DIRBUF: i64 = 65536
27const RM_STATBUF: i64 = 4096

functions

29func main() -> i64