code wiki / _hdl_build / nx_transient_monitor.nx

nx_transient_monitor.nx

buildroot/runtime/_hdl_build/nx_transient_monitor.nx

6336 B103 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind tooltopic transient
docsdependenciesstructsconstsfunctions

about

nx_transient_monitor.nx -- S-CLASS transient / flakiness monitor (hardware-rung-up). The Nishi ecosystem must ACCOUNT FOR every transient (intermittent failure, watchdog timeout) -- NEVER hand-wave "transient, watch if it recurs". This runs a target N times under a per-run watchdog, records EVERY outcome (exit code + duration), and turns "transient" into a MEASURED flakiness rate + verdict (STABLE / FLAKY / BROKEN) with a durable SOVEREIGN record (seg-store pattern: per-key file + index under knowledge/store, NO tsv/csv/json). usage: nx_transient_monitor <runs> <timeout_ms> <elf-path> exit 0 = STABLE, 1 = FLAKY (a transient is real -> root-cause), 2 = BROKEN license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_transient_monitor.nx nx_transient_monitor_gate.nx nx_transient_sweep.nx

imports: nx_syscalls.nx

imported by: nx_transient_monitor_gate.nxnx_transient_sweep.nx

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

main tm_w sys_write tm_atoi sys_mmap tm_probe sys_mmap ↻ tm_run_once sys_now_ms sys_mmap ↻ sys_clock_gettime_mono sys_fork sys_mmap ↻ sys_openat_wr sys_dup3 sys_execve sys_exit sys_sleep_ms sys_mmap ↻ sys_munmap nx_kill sys_wait4 tm_verdict tm_wn tm_w ↻ sys_mmap ↻ sys_write ↻ tm_record sys_mkdir sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real sys_mmap ↻ tm_cat tm_n sys_mmap ↻ sys_openat_wr ↻ sys_write ↻ sys_close sys_openat_append

structs

none

consts

10const TM_MAGIC_1000000000: i64 = 1000000000
11const TM_MAGIC_2048: i64 = 2048
13const TM_STORE_DIR: *u8 = "knowledge/store"

functions

15func tm_w(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 3: tm_wnmainmain calls 1: sys_write
16func tm_wn(v: i64) -> i64 { var m: i64=v; var k: i64=0; if m<0{tm_w("-" as *u8);m=0-m} let t: *u8=sys_mmap(24); if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var o: *u8=sys_mmap(24); var w: i64=0; var q: i64=k-1; while q>=0{o[w]=t[q];w=w+1;q=q-1} sys_write(1,o,w); return 0 }
called by 2: mainmain calls 3: tm_wsys_mmapsys_write
17func tm_cat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var i: i64=0; while s[i]!=(0 as u8){dst[o]=s[i];o=o+1;i=i+1} return o }
called by 1: tm_record
18func tm_n(dst: *u8, off: i64, v: i64) -> i64 { var o: i64=off; var m: i64=v; if m<0{dst[o]=45 as u8;o=o+1;m=0-m} let t: *u8=sys_mmap(24); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{dst[o+i]=t[k-1-i];i=i+1} return o+k }
called by 1: tm_record calls 1: sys_mmap
19func tm_atoi(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8){ if s[i]>=(48 as u8){ if s[i]<=(57 as u8){ v=v*10+((s[i] as i64)-48) } } i=i+1 } return v }
called by 2: mainmain
22func tm_run_once(elf: *u8, timeout_ms: i64, dur_out: *i64) -> i64
44func tm_probe(elf: *u8, runs: i64, timeout_ms: i64, out: *i64) -> i64
called by 3: mainmainmain calls 2: sys_mmaptm_run_once
63func tm_verdict(pass: i64, runs: i64) -> i64 { if pass==runs {return 0} if pass==0 {return 2} return 1 }
called by 3: mainmainmain
66func tm_record(elf: *u8, runs: i64, out: *i64, verdict: i64) -> i64
87func main(argc: i64, argv: *i64) -> i64