code wiki / _hdl_build / nx_costcal.nx
nx_costcal.nx
buildroot/runtime/_hdl_build/nx_costcal.nx
about
nx_costcal.nx -- THE COST CALIBRATION CENSUS (2026-09-16): every board's declared rung cost (u) against the
wall-clock its own journal recorded from the rung's first row to its last land row, written as the ledger the
compare emitter and the ranker read to turn u into hours.
nx_costcal [ledger-path] population = regen.list (published order, both trees); default ledger
knowledge/status/costcal.ledger, truncate-written; verdict LAST
exit 0 CALIBRATED | 1 UNCALIBRATED (fewer calibrated rungs than the distinct-rank floor) | 3 NO-POPULATION
WHY. The plan's unit row says "estimates recalibrate as rungs land and PR7 actuals write back" and PR7 stayed
_ABSENT_ since 2026-08-20, so every u on every board has been a declaration with no ratio to hours behind it.
The record already holds the actuals: more than a thousand land rows across the boards (a grep of
buildroot/knowledge/compare hit its 1 MiB capture on them, 2026-09-16). This organ reads them all, excludes
by name what cannot be calibrated (a land row that is the rung's first row; a rung with no declared cost),
and publishes the quantiles with their n. ONE grammar for the ledger line lives in nx_costest_lib, shared
with every reader, so the writer and the readers cannot drift.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_barfresh_lib.nxnx_costest_lib.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 20 | const CC_ARG_LEDGER: i64 = 1 |
| 21 | const CC_STDOUT: i64 = 1 |
| 22 | const CC_MODE_644: i64 = 420 |
| 23 | const CC_REGEN_DOM: *u8 = "regen" |
| 24 | const CC_REGEN_SUFFIX: *u8 = ".list" |
| 25 | const CC_LEDGER_DEFAULT: *u8 = "knowledge/status/costcal.ledger" |
| 26 | const CC_EXIT_OK: i64 = 0 |
| 27 | const CC_EXIT_UNCAL: i64 = 1 |
| 28 | const CC_EXIT_NOPOP: i64 = 3 |
| 29 | const CC_NUM_CAP: i64 = 32 |
| 30 | const CC_HEADER_RESERVE: i64 = 2048 |
| 31 | const CC_WIP_STATUS: *u8 = "knowledge/status/wip.status" // EC57: ONE canonical WIP line, truncate-written, passed through verbatim by the boot digest |
| 32 | const CC_WIP_SUFFIX: *u8 = ".wip" // a run against a non-default ledger writes its WIP line beside THAT ledger, never the production status |
| 33 | const CC_SEC_PER_DAY: i64 = 86400 |
| 34 | const CC_CH_COMMA: i64 = 44 |
functions
| 36 | func cc_w(s: *u8) -> i64 { return sys_write(CC_STDOUT, s, ces_slen(s)) } |
| 37 | func cc_wn(v: i64) -> i64 { let b: *u8 = sys_mmap(CC_NUM_CAP); let o: i64 = ces_fmt_int(b, 0, v); return sys_write(CC_STDOUT, b, o) } |
| 40 | func cc_beside(path: *u8, suffix: *u8) -> *u8 |
| 48 | func cc_walk(lst: *u8, ln: i64, mode: i64, samples: *i64, scap: i64, sc: *i64, st: *i64, rows: *u8, rcap: i64, ro: *i64, bytes_out: *i64) -> i64 called by 1: main calls 9: sys_mmapces_line_endbf_read_planct_first_publishedct_second_publishedces_census_plan+3 |
| 89 | func main(argc: i64, argv: *i64) -> i64 |