code wiki / (root) / nx_fpsmeter.nx

nx_fpsmeter.nx

buildroot/runtime/nx_fpsmeter.nx

1932 B36 linesdepth 0pulls 0 transitivereach 8 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_fpsmeter.nx -- sovereign rolling FPS meter: count the frame timestamps within the last 1000 ms. The call stack currently measures NOTHING (can't answer "what fps are we at"); this is the instrument ("monitor the system" law). State m[*i64]: [0]=head, [1]=count, [2 + i]=timestamp ring (FM_CAP). Assumes a real ms clock (sys_now_ms). Pure buffer ops -> wasm-friendly (client) AND daemon-reusable. license_tier: ORIGINAL

dependencies 0 imports · 2 importers

nx_fpsmeter.nx nx_enginelab_lib.nx nx_fpsmeter_gate.nx

imports: none

imported by: nx_enginelab_lib.nxnx_fpsmeter_gate.nx

structs

none

consts

6const FM_CAP: i64 = 128 // tracks up to 128 fps

functions

8func fm_init(m: *i64) -> i64 { m[0] = 0; m[1] = 0; var i: i64 = 0; while i < FM_CAP { m[2 + i] = 0; i = i + 1 } return 0 }
10func fm_tick(m: *i64, now_ms: i64) -> i64
18func fm_fps(m: *i64, now_ms: i64) -> i64