code wiki / _hdl_build / nx_governed_pulse.nx

nx_governed_pulse.nx

buildroot/runtime/_hdl_build/nx_governed_pulse.nx

7150 B102 linesdepth 4pulls 6 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_governed_pulse.nx -- Monitors system resources and initiates autonomous self-builds on a scheduled beat cycle.

dependencies 5 imports · 0 importers

nx_gate_gn.nx nx_gate_base.nx nx_sysload.nx nx_resource_governor.nx nx_syscalls.nx nx_governed_pulse.nx

imports: nx_gate_gn.nxnx_gate_base.nxnx_sysload.nxnx_resource_governor.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main gw sys_write sys_openat_append sl_ncpu sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sl_count_substr sl_freemem_mb sys_mmap ↻ sys_read_file ↻ sl_active_conns_8443 sys_mmap ↻ sys_read_file ↻ sl_count_substr ↻ sl_loadavg_milli sys_mmap ↻ sys_read_file ↻ gp_budget rg_serve_first rg_memory_ok rg_hosting_reserve rg_hosting_ceil_milli rg_should_backoff rg_worker_budget gn lw sys_write ↻ ln_ sys_mmap ↻ sys_write ↻ fire_god_cycle sys_fork sys_openat_wr sys_dup3

structs

none

consts

19const NX_GP_BEATS: i64 = 3 // bounded for the gate; unbounded as the daemon
20const NX_GP_MEM_FLOOR_MB: i64 = 256
21const NX_GP_BUSY_LOAD: i64 = 99000 // a simulated busy-host load (milli) for the back-off beat

functions

23func grow(name: *u8, ok: i64) -> i64 { if ok==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw("
calls 1: gw
25func lw(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 2: sys_mmapsys_write
26func ln_(fd: i64, v: i64) -> i64 { let b: *u8=sys_mmap(24); var m: i64=v; if m<0{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{b[i]=t[k-1-i];i=i+1} sys_write(fd,b,k); return 0 }
28func gp_budget(ncpu: i64, load_milli: i64, free_mb: i64, conns: i64) -> i64
36func fire_god_cycle() -> i64
49func main() -> i64