nx_frame_pacing_lib.nx
buildroot/runtime/nx_frame_pacing_lib.nx
about
nx_frame_pacing_lib.nx -- THE NATIVE HALF OF THE FRAME-BUDGET RULER: one conf reader, one plane reader, one
frames reader and ONE judgement call shared by every native consumer (the pacing gate, the world telemetry
sink, any future beat). nx_perf_lib holds the arithmetic and is wasm-compatible by construction (no syscalls);
this lib is the layer that touches the conf and the SOVEREIGN STORE PLANE, so the wasm engine, the served HUD,
the gate and the sink all compute the same numbers from the same window and read the same bands.
THE PLANE, NOT A FILE (operator 2026-09-02: "you just built with tsv yet again instead of sota data file
systems"; the 2026-08-13 standing order already forbade third-party formats in the plane). Frame windows are
rows of the seg-store plane knowledge/store/frametrace- written through nx_store_seed_lib (the same locked
append every board uses), never a .tsv beside it. One row per beacon:
id=<world>_<ts> | world | ts | budget(ms:src) | n | total | page p50/p95/p99 | sink p50/p95/p99 | worst |
worst_ever | spikes | over | verdict:why | twins | frames_csv (15 columns, under the 16-col plane cap)
The plane is append-only, so it IS the time spine: the latest row for a world is the current window and every
earlier row is history -- readable by any seat through `nx_store_put knowledge/store/frametrace- load`.
THE CONF (knowledge/frame_pacing.conf): `key=value` rows, `#` comments:
budget_ms min_samples p50_permil p95_permil p99_permil jank_permil
Bands are permil OF THE BUDGET so one conf serves every display refresh rate.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 3 imports · 7 importers
imports: nx_syscalls.nxnx_perf_lib.nxnx_store_seed_lib.nx
imported by: nx_frame_pacing_gate.nxnx_frame_raw_ingest_gate.nxnx_frame_raw_wasm_gate.nxnx_frameab.nxnx_world_telemetry.nxnx_world_telemetry_gpu_candidate.nxnx_world_telemetry_v2_candidate.nx
structs
| none |
consts
| 24 | const FPC_CONF: *u8 = "knowledge/frame_pacing.conf" |
| 25 | const FPC_PLANE: *u8 = "knowledge/store/frametrace-" |
| 27 | const FPC_BUDGET: i64 = 0 |
| 28 | const FPC_MIN_N: i64 = 1 |
| 29 | const FPC_P50: i64 = 2 |
| 30 | const FPC_P95: i64 = 3 |
| 31 | const FPC_P99: i64 = 4 |
| 32 | const FPC_JANK: i64 = 5 |
| 33 | const FPC_N: i64 = 6 |
| 34 | const FPC_ABSENT: i64 = 0 - 1 |
| 35 | const FPC_WORLD_MAX: i64 = 32 // a world name longer than this is not one of ours (beach, craft, vale ...) |
| 37 | const FPC_COL_ID: i64 = 0 |
| 38 | const FPC_COL_WORLD: i64 = 1 |
| 39 | const FPC_COL_TS: i64 = 2 |
| 40 | const FPC_COL_BUDGET: i64 = 3 |
| 41 | const FPC_COL_N: i64 = 4 |
| 42 | const FPC_COL_TOTAL: i64 = 5 |
| 43 | const FPC_COL_PAGE: i64 = 6 |
| 44 | const FPC_COL_SINK: i64 = 7 |
| 45 | const FPC_COL_WORST: i64 = 8 |
| 46 | const FPC_COL_WEVER: i64 = 9 |
| 47 | const FPC_COL_SPIKES: i64 = 10 |
| 48 | const FPC_COL_OVER: i64 = 11 |
| 49 | const FPC_COL_VERDICT: i64 = 12 |
| 50 | const FPC_COL_TWINS: i64 = 13 |
| 51 | const FPC_COL_FRAMES: i64 = 14 |
| 52 | const FPC_COLS: i64 = 15 |
| 53 | const FPC_CH_NL: i64 = 10 |
| 54 | const FPC_CH_CR: i64 = 13 |
| 55 | const FPC_CH_TAB: i64 = 9 |
| 56 | const FPC_CH_HASH: i64 = 35 |
| 57 | const FPC_CH_EQ: i64 = 61 |
| 58 | const FPC_CH_COLON: i64 = 58 |
| 59 | const FPC_CH_0: i64 = 48 |
| 60 | const FPC_CH_9: i64 = 57 |
| 61 | const FPC_CH_a: i64 = 97 |
| 62 | const FPC_CH_z: i64 = 122 |
| 63 | const FPC_CH_UNDERSCORE: i64 = 95 |
| 64 | const FPC_CH_COMMA: i64 = 44 |
| 65 | const FPC_CH_LBRACK: i64 = 91 |
| 66 | const FPC_CH_RBRACK: i64 = 93 |
| 67 | const FPC_CH_SPACE: i64 = 32 |
| 68 | const FPC_WHY_NONE: i64 = 0 |
| 205 | const FPC_FRAME_MAX_MS: i64 = 9223372036854775807 / PF_N / 10 |
functions
| 70 | func fpc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 71 | func fpc_eol(b: *u8, n: i64, i: i64) -> i64 { var j: i64 = i; var f: i64 = n; var go: i64 = 1; while go == 1 { if j >= n { go = 0 } else { if b[j] == (FPC_CH_NL as u8) { f = j; go = 0 } else { j = j + 1 } } } return f } |
| 72 | func fpc_slice_eq(b: *u8, a: i64, e: i64, lit: *u8) -> i64 |
| 80 | func fpc_slice_int(b: *u8, s: i64, e: i64) -> i64 |
| 101 | func fpc_conf_int(buf: *u8, n: i64, key: *u8) -> i64 |
| 123 | func fpc_load(path: *u8, out: *i64) -> i64 |
| 142 | func fpc_col_start(b: *u8, s: i64, e: i64, col: i64) -> i64 |
| 155 | func fpc_col_end(b: *u8, s: i64, e: i64) -> i64 |
| 162 | func fpc_col_int(b: *u8, s: i64, e: i64, col: i64) -> i64 |
| 172 | func fpc_plane_latest(prefix: *u8, world: *u8, out: *u8, cap: i64, rows_seen: *i64) -> i64 |
| 199 | func fpc_row_frames(row: *u8, n: i64, r: *i64, budget_ms: i64) -> i64 |
| 206 | func fpc_frame_space(c: i64) -> i64 called by 1: fpc_csv_parse |
| 211 | func fpc_csv_parse(b: *u8, s: i64, e: i64, r: *i64, budget_ms: i64) -> i64 |
| 250 | func fpc_frames_parse(b: *u8, n: i64, r: *i64, budget_ms: i64) -> i64 |
| 272 | func fpc_world_safe(w: *u8, n: i64) -> i64 |
| 290 | func fpc_plane_append(prefix: *u8, row: *u8, n: i64) -> i64 |
| 308 | func fpc_judge(r: *i64, conf: *i64, budget_ms: i64, why: *i64) -> i64 |
| 311 | func fpc_verdict_name(v: i64) -> *u8 called by 1: main |
| 317 | func fpc_why_name(w: i64) -> *u8 called by 1: main |