code wiki / _hdl_build / nx_budget_run.nx

nx_budget_run.nx

buildroot/runtime/_hdl_build/nx_budget_run.nx

4144 B125 linesdepth 2pulls 3 transitivereach 0 importersview sourcekind tooltopic budget
docsdependenciesstructsconstsfunctions

about

nx_budget_run.nx -- TIME-BUDGETED step runner: turns silent slowness into a FILED defect automatically. Operator 2026-06-10: "slowness anywhere in our entire ecosystem is a total failure." The 885KB sovereign assembly that silently ate 90 minutes would have been auto-filed by this organ at its budget line. Usage: nx_budget_run <budget_seconds> <path> [args...] - runs <path>, polling wait4(WNOHANG) on a 100ms beat - inside budget -> "BUDGET-OK <path> elapsed=<s>s limit=<s>s", exit = child's exit code - budget blown -> kill -9, "BUDGET-EXCEEDED <path> limit=<s>s" appended to the sentinel log (the PM/loop dispatcher's queue), exit 99 The wrapper is the PREVENTION pillar: every build/step the team runs through it converts "mysteriously slow" into a logged, gated verdict. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_kill_portable.nx nx_budget_run.nx

imports: nx_syscalls.nxnx_kill_portable.nx

imported by: nobody (leaf or entry point)

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

main sys_write br_atoi sys_mmap sys_now_us sys_mmap ↻ sys_clock_gettime_mono sys_fork sys_execve sys_exit sys_wait4 nxk_kill sys_sleep_ms sys_mmap ↻ sys_munmap br_app br_app_n sys_openat_append sys_close

structs

none

consts

21const BR_MAGIC_1000000: i64 = 1000000
23const BR_EXIT_USAGE: i64 = 2
24const BR_EXIT_BUDGET: i64 = 99
25const BR_LOG_PATH: *u8 = "/tmp/nishi_perf_sentinel.log" as *u8
26const BR_BEAT_MS: i64 = 100

functions

28func br_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
29func br_app(dst: *u8, off: i64, s: *u8) -> i64
called by 1: main
34func br_app_n(dst: *u8, off: i64, v: i64) -> i64
called by 1: main
47func br_atoi(s: *u8) -> i64
called by 1: main
60func main(argc: i64, argv: *i64) -> i64