code wiki / (root) / nx_frame_pacing_lib.nx

nx_frame_pacing_lib.nx

buildroot/runtime/nx_frame_pacing_lib.nx

14419 B324 linesdepth 5pulls 8 transitivereach 8 importersview sourcekind librarytopic frame
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_perf_lib.nx nx_store_seed_lib.nx nx_frame_pacing_lib.nx nx_frame_pacing_gate.nx nx_frame_raw_ingest_gate.nx nx_frame_raw_wasm_gate.nx nx_frameab.nx nx_world_telemetry.nx nx_world_telemetry_gpu_candidate.n nx_world_telemetry_v2_candidate.nx

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

24const FPC_CONF: *u8 = "knowledge/frame_pacing.conf"
25const FPC_PLANE: *u8 = "knowledge/store/frametrace-"
27const FPC_BUDGET: i64 = 0
28const FPC_MIN_N: i64 = 1
29const FPC_P50: i64 = 2
30const FPC_P95: i64 = 3
31const FPC_P99: i64 = 4
32const FPC_JANK: i64 = 5
33const FPC_N: i64 = 6
34const FPC_ABSENT: i64 = 0 - 1
35const FPC_WORLD_MAX: i64 = 32 // a world name longer than this is not one of ours (beach, craft, vale ...)
37const FPC_COL_ID: i64 = 0
38const FPC_COL_WORLD: i64 = 1
39const FPC_COL_TS: i64 = 2
40const FPC_COL_BUDGET: i64 = 3
41const FPC_COL_N: i64 = 4
42const FPC_COL_TOTAL: i64 = 5
43const FPC_COL_PAGE: i64 = 6
44const FPC_COL_SINK: i64 = 7
45const FPC_COL_WORST: i64 = 8
46const FPC_COL_WEVER: i64 = 9
47const FPC_COL_SPIKES: i64 = 10
48const FPC_COL_OVER: i64 = 11
49const FPC_COL_VERDICT: i64 = 12
50const FPC_COL_TWINS: i64 = 13
51const FPC_COL_FRAMES: i64 = 14
52const FPC_COLS: i64 = 15
53const FPC_CH_NL: i64 = 10
54const FPC_CH_CR: i64 = 13
55const FPC_CH_TAB: i64 = 9
56const FPC_CH_HASH: i64 = 35
57const FPC_CH_EQ: i64 = 61
58const FPC_CH_COLON: i64 = 58
59const FPC_CH_0: i64 = 48
60const FPC_CH_9: i64 = 57
61const FPC_CH_a: i64 = 97
62const FPC_CH_z: i64 = 122
63const FPC_CH_UNDERSCORE: i64 = 95
64const FPC_CH_COMMA: i64 = 44
65const FPC_CH_LBRACK: i64 = 91
66const FPC_CH_RBRACK: i64 = 93
67const FPC_CH_SPACE: i64 = 32
68const FPC_WHY_NONE: i64 = 0
205const FPC_FRAME_MAX_MS: i64 = 9223372036854775807 / PF_N / 10

functions

70func fpc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
71func 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 }
72func fpc_slice_eq(b: *u8, a: i64, e: i64, lit: *u8) -> i64
80func fpc_slice_int(b: *u8, s: i64, e: i64) -> i64
101func fpc_conf_int(buf: *u8, n: i64, key: *u8) -> i64
123func fpc_load(path: *u8, out: *i64) -> i64
142func fpc_col_start(b: *u8, s: i64, e: i64, col: i64) -> i64
155func fpc_col_end(b: *u8, s: i64, e: i64) -> i64
162func fpc_col_int(b: *u8, s: i64, e: i64, col: i64) -> i64
172func fpc_plane_latest(prefix: *u8, world: *u8, out: *u8, cap: i64, rows_seen: *i64) -> i64
199func fpc_row_frames(row: *u8, n: i64, r: *i64, budget_ms: i64) -> i64
206func fpc_frame_space(c: i64) -> i64
called by 1: fpc_csv_parse
211func fpc_csv_parse(b: *u8, s: i64, e: i64, r: *i64, budget_ms: i64) -> i64
250func fpc_frames_parse(b: *u8, n: i64, r: *i64, budget_ms: i64) -> i64
called by 2: mainmain calls 2: fpc_slenfpc_csv_parse
272func fpc_world_safe(w: *u8, n: i64) -> i64
called by 2: mainmain
290func fpc_plane_append(prefix: *u8, row: *u8, n: i64) -> i64
308func fpc_judge(r: *i64, conf: *i64, budget_ms: i64, why: *i64) -> i64
called by 1: main calls 1: pf_referee
311func fpc_verdict_name(v: i64) -> *u8
called by 1: main
317func fpc_why_name(w: i64) -> *u8
called by 1: main