nx_linkqual_cycles.nx
buildroot/runtime/nx_linkqual_cycles.nx
about
nx_linkqual_cycles.nx -- CYCLE-ACCURATE hot-path measurement of the
link-quality substrate using the sovereign __rdtsc() intrinsic. This is
the hardware-limit metric: reference-cycles per op straight off the CPU's
timestamp counter, with NO per-op syscall in the loop (two reads bracket
N calls, amortized).
HONEST METHOD:
- a warmup pass is discarded (caches/branch-predictors warm).
- inputs vary per-iteration so the work can't be constant-folded.
- rdtsc measures INVARIANT-TSC reference cycles (the constant base-rate
counter), NOT turbo-scaled retired core cycles -- so we ALSO bracket
the identical loop with the microsecond clock and derive the effective
TSC GHz (cycles/ns). If that GHz matches the CPU's base clock, the two
independent clocks agree and the numbers are trustworthy (1:1 cross-
validation, [[feedback-1to1-proof-no-proxy-2026-05-28]]).
license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_linkqual.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 K_MAGIC_2000000: i64 = 2000000 |
| 21 | const K_MAGIC_1000000000: i64 = 1000000000 |
| 22 | const K_MAGIC_200000: i64 = 200000 |
| 23 | const K_MAGIC_2654435761: i64 = 2654435761 |
functions
| 25 | func bdec(n: i64) -> i64 |
| 37 | func bcenti(n: i64) -> i64 |
| 44 | func report(label: *u8, llen: i64, n: i64, cyc: i64, us: i64) -> i64 |
| 57 | func main() -> i64 |