nx_gauge_lib.nx
buildroot/runtime/nx_gauge_lib.nx
about
nx_gauge_lib.nx -- CE9 (codeeffectiveness sm_gauge_alarm): THE ONE RULER for a GAUGE HEARTBEAT -- written by the beat
that measures a gauge, read by the /compare emitter that renders it, and driven in-process by its gate, so the writer
and the reader cannot disagree about what STALE, BLIND or ABSENT mean: one classifier, one file shape, one renderer.
THE STAMP is the estate's dead-man heartbeat shape -- `ts=<epoch>` FIRST, the way nx_http_probe_lib.hp_write_stamp
writes it and nx_cron_watch reads it -- followed by the gauge fields on the same line:
ts=<epoch> gauge=<n> axes_known=<k> axes_total=<t> cadence_s=<c>
Truncate-written in ONE sys_write: a reader that catches a partial write sees a shorter ts, i.e. an OLDER stamp, which
fails in the safe direction. hp_write_stamp is not composed only because it carries ts alone and a gauge needs its
axes beside it; the SHAPE is identical so the cron dead-man's switch can watch this file with no change.
STATES (ga_state), decided in this order so the most alarming truth wins:
ABSENT no readable stamp: nothing has measured, or the writer died before its first beat
STALE age > max_age, or age < 0 (a future stamp is clock skew: UNOBSERVABLE, never fresh)
BLIND axes_known < axes_total: an axis abstained, and the number beside it acquits nothing
FRESH inside max_age with every axis observed
max_age is DERIVED from the writer's cadence (GA_MISSED_BEATS beats): one missed beat is tolerated, the second is
blindness. ga_render prints the gauge VALUE only when the state is FRESH -- a stale gauge reads STALE on the page and
never as zero, which is the rung's accept rule. A stamp whose cadence field is absent judges STALE by construction.
license_tier: ORIGINAL No hw writes.
dependencies 2 imports · 15 importers
diagram shows first 10 each side; +0 more imports, +5 more importers in the complete lists below.
imports: nx_sovjson_lib.nxnx_syscalls.nx
imported by: nx_compare_shared_fit_lib_20260910.nxnx_gauge_gate.nxnx_goalmap_lib.nxnx_goalmap_record_gate.nxnx_seat.nxnx_stepsolve_gate.nxnx_stepsolve_lib.nxnx_swcompare_evidence_lib_t138.nxnx_swcompare_growth_candidate_20260910.nxnx_swcompare_heading_lib_20260907.nxnx_swcompare_ladder_candidate.nxnx_swcompare_lib.nxnx_swcompare_preview_lib_t56.nxnx_swcompare_production_lib_20260907.nxnx_swcompare_release_candidate.nx
structs
| none |
consts
| 24 | const GA_STAMP_PROD: *u8 = "knowledge/status/seat_gauge.stamp" |
| 25 | const GA_LINE: i64 = 512 |
| 26 | const GA_MODE644: i64 = 420 |
| 27 | const GA_NL: i64 = 10 |
| 28 | const GA_SP: i64 = 32 |
| 29 | const GA_EQ: i64 = 61 |
| 30 | const GA_D0: i64 = 48 |
| 31 | const GA_D9: i64 = 57 |
| 32 | const GA_WORD: i64 = 8 |
| 33 | const GA_MISSED_BEATS: i64 = 2 // derived bar: the second missed beat is blindness, the first is tolerated |
| 35 | const GA_FRESH: i64 = 0 |
| 36 | const GA_STALE: i64 = 1 |
| 37 | const GA_BLIND: i64 = 2 |
| 38 | const GA_ABSENT: i64 = 3 |
| 40 | const GA_F_TS: i64 = 0 |
| 41 | const GA_F_GAUGE: i64 = 1 |
| 42 | const GA_F_KNOWN: i64 = 2 |
| 43 | const GA_F_TOTAL: i64 = 3 |
| 44 | const GA_F_CADENCE: i64 = 4 |
| 45 | const GA_F_SLOTS: i64 = 8 |
functions
| 47 | func ga_max_age(cadence_s: i64) -> i64 { return cadence_s * GA_MISSED_BEATS } |
| 50 | func ga_field(q: *u8, n: i64, key: *u8) -> i64 |
| 80 | func ga_stamp_write(path: *u8, now: i64, gauge: i64, known: i64, total: i64, cadence_s: i64) -> i64 |
| 97 | func ga_stamp_read(path: *u8, f: *i64) -> i64 |
| 114 | func ga_state(now: i64, ts: i64, max_age: i64, known: i64, total: i64) -> i64 called by 1: ga_judge |
| 122 | func ga_state_name(st: i64) -> *u8 |
| 130 | func ga_render(d: *u8, p0: i64, st: i64, age: i64, max_age: i64, gauge: i64, known: i64, total: i64) -> i64 |
| 155 | func ga_judge(path: *u8, now: i64, cadence_s: i64, f: *i64) -> i64 called by 21: gauge_pass_headinggaps_pass_headingmainmainmaingauge_pass_heading+15 calls 3: ga_stamp_readga_statega_max_age |