code wiki / (root) / nx_leak_check_gate.nx

nx_leak_check_gate.nx

buildroot/runtime/nx_leak_check_gate.nx

9864 B158 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

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

nx_leak_check_lib.nx nx_leak_check_gate.nx

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

main lg_fill_ts lc_classify lc_classify_t lc_median lc_sort lc_mad lc_abs lc_sort ↻ lc_max lc_mk_s lc_sign lc_theil_sen lc_sort ↻ lc_mk_tau_permille lc_mk_sig_up lg_check lg_puts lc_theil_sen ↻ lc_mk_s ↻ lc_mk_tau_permille ↻ lc_mk_sig_up ↻ lc_classify_t ↻ lc_row_valid lg_puts ↻

structs

none

consts

9const LG_CHECKS: i64 = 19
10const LG_PTR: i64 = 16
11const LG_N: i64 = 8 // samples in the generated trend series
12const LG_N4: i64 = 4 // small series for exact-value tests
13const LG_BASE: i64 = 500 // baseline kB
14const LG_TREND: i64 = 100 // per-sample rise (leak series)
15const LG_JITTER: i64 = 150 // down-jag on odd samples -> a VARIABLE (non-monotone) leak
16const LG_AMP: i64 = 400 // sawtooth / step / churn amplitude
17const LG_THREE: i64 = 3 // 3-level cycle -> high MAD (churn, median not a mode)
18const LG_SPIKE_AMP: i64 = 2000 // one-sample outlier for the SPIKE test
19const LG_BASE_FD: i64 = 10 // baseline open descriptors (fd meter test)
20const LG_FD_STEP: i64 = 3 // fd climb per sample -> 3 fd/min (an fd leak: tiny in kB terms, real in fd terms)
21const LG_CPU_HI: i64 = 800 // permille of a core: a sustained busy-loop (80% -- flat, no trend)
22const LG_CPU_LO: i64 = 50 // permille: a normal lightly-active daemon (5%)
23const LG_PAIRS: i64 = 496
24const LG_ASCII_0: i64 = 48
25const LG_SLASH: i64 = 47

functions

27func 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 }
called by 2: lg_checkmain
28func lg_check(name: *u8, ok: i64, pass: *i64) -> i64
called by 1: main calls 1: lg_puts
34func 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
36func main() -> i64