nx_leak_check_gate.nx
buildroot/runtime/nx_leak_check_gate.nx
about
nx_leak_check_gate.nx -- gates the leak-health certifier's REAL DATA-SCIENCE core on SYNTHETIC series
(deterministic, integer). The load-bearing test: a VARIABLE/jagged leak (down-up-down but trending up) is
CONVICTED -- the case a monotone assumption or a linear-fit R2 would MISS. Also proves honest ACQUITTAL of
a bounded sawtooth (variable but not leaking) and a one-time startup step (warmup-trimmed). Exact Mann-
Kendall S / tau / Theil-Sen values checked against hand-computed ground truth. Exit 0 on all-PASS.
license_tier: ORIGINAL expect_exit: 0
dependencies 1 imports · 0 importers
imports: nx_leak_check_lib.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 9 | const LG_CHECKS: i64 = 19 |
| 10 | const LG_PTR: i64 = 16 |
| 11 | const LG_N: i64 = 8 // samples in the generated trend series |
| 12 | const LG_N4: i64 = 4 // small series for exact-value tests |
| 13 | const LG_BASE: i64 = 500 // baseline kB |
| 14 | const LG_TREND: i64 = 100 // per-sample rise (leak series) |
| 15 | const LG_JITTER: i64 = 150 // down-jag on odd samples -> a VARIABLE (non-monotone) leak |
| 16 | const LG_AMP: i64 = 400 // sawtooth / step / churn amplitude |
| 17 | const LG_THREE: i64 = 3 // 3-level cycle -> high MAD (churn, median not a mode) |
| 18 | const LG_SPIKE_AMP: i64 = 2000 // one-sample outlier for the SPIKE test |
| 19 | const LG_BASE_FD: i64 = 10 // baseline open descriptors (fd meter test) |
| 20 | const LG_FD_STEP: i64 = 3 // fd climb per sample -> 3 fd/min (an fd leak: tiny in kB terms, real in fd terms) |
| 21 | const LG_CPU_HI: i64 = 800 // permille of a core: a sustained busy-loop (80% -- flat, no trend) |
| 22 | const LG_CPU_LO: i64 = 50 // permille: a normal lightly-active daemon (5%) |
| 23 | const LG_PAIRS: i64 = 496 |
| 24 | const LG_ASCII_0: i64 = 48 |
| 25 | const LG_SLASH: i64 = 47 |
functions
| 27 | func lg_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 28 | func lg_check(name: *u8, ok: i64, pass: *i64) -> i64 |
| 34 | func lg_fill_ts(ts: *i64, n: i64) -> i64 { var k: i64 = 0; while k < n { ts[k] = k * LC_MS_PER_MIN; k = k + 1 } return 0 } called by 1: main |
| 36 | func main() -> i64 |