nx_metric_ledger.nx
buildroot/runtime/nx_metric_ledger.nx
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
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
| 13 | const ML_MAGIC_4611686018427387904: i64 = 4611686018427387904 |
| 15 | const ML_LOG: *u8 = "knowledge/status/nx_metric_ledger.log" |
| 16 | const ML_CAP: i64 = 4194304 |
functions
| 18 | func 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 } |
| 19 | func ml_wn(v: i64) -> i64 |
| 23 | func 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 } |
| 24 | func ml_fn(fd: i64, v: i64) -> i64 |
| 28 | func 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 |
| 31 | func ml_parse(buf: *u8, p0: i64, n: i64) -> i64 called by 1: ml_prev |
| 45 | func ml_prev(name: *u8) -> i64 |
| 92 | func ml_report(name: *u8, value: i64, dir: i64, unit: *u8, src: *u8) -> i64 called by 6: he_qoe_checkhe_passmainmainmainswarm_pass calls 8: ml_prevsys_openat_appendml_fwml_fnsys_now_ussys_close+2 |
| 120 | func main() -> i64 { return 0 } |