code wiki / (root) / nx_metric_ledger.nx

nx_metric_ledger.nx

buildroot/runtime/nx_metric_ledger.nx

5973 B120 linesdepth 2pulls 2 transitivereach 6 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_metric_ledger.nx -- RETURN-AND-REPORT primitive (operator 2026-07-03: "on everything we do on the nishi ecosystem teams apis etc it should be a feedback loop with return and report as a key part so that we always know if we are moving toward more or less performance and quality"). Every organ that measures ANYTHING calls ml_report(name, value, dir, unit, src): 1. appends `METRIC <name> t_us=<t> value=<v> unit=<u> src=<s>` to knowledge/status/nx_metric_ledger.log 2. scans backward for the PREVIOUS row of the same metric 3. prints + returns the TREND: BETTER / WORSE / FLAT / NEW (dir: +1 higher-is-better, -1 lower-is-better) So every run of every measuring organ answers "are we moving toward more or less performance/quality" mechanically -- no one has to remember to compare. Append-only (rule #13); the ledger IS the history. Returns: 2=BETTER 1=FLAT 0=NEW -1=WORSE (callers may gate on WORSE = regression trap). No main logic beyond a compile smoke; the gate is nx_metric_ledger_gate. license_tier: ORIGINAL

dependencies 1 imports · 6 importers

nx_syscalls.nx nx_metric_ledger.nx nx_health_eval.nx nx_metric_ledger_gate.nx nx_vcodec_realseq_gate.nx nx_vcodec_speed_bench.nx nx_video_qoe_live.nx nx_video_swarm_probe.nx

imports: nx_syscalls.nx

imported by: nx_health_eval.nxnx_metric_ledger_gate.nxnx_vcodec_realseq_gate.nxnx_vcodec_speed_bench.nxnx_video_qoe_live.nxnx_video_swarm_probe.nx

structs

none

consts

13const ML_MAGIC_4611686018427387904: i64 = 4611686018427387904
15const ML_LOG: *u8 = "knowledge/status/nx_metric_ledger.log"
16const ML_CAP: i64 = 4194304

functions

18func ml_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 2: ml_reportmain calls 1: sys_write
19func ml_wn(v: i64) -> i64
called by 1: ml_report calls 2: sys_mmapsys_write
23func ml_fw(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: ml_report calls 1: sys_write
24func ml_fn(fd: i64, v: i64) -> i64
called by 1: ml_report calls 2: sys_mmapsys_write
28func ml_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: ml_prev
31func ml_parse(buf: *u8, p0: i64, n: i64) -> i64
called by 1: ml_prev
45func ml_prev(name: *u8) -> i64
92func ml_report(name: *u8, value: i64, dir: i64, unit: *u8, src: *u8) -> i64
120func main() -> i64 { return 0 }