code wiki / _hdl_build / nx_perf_counters_test.nx
nx_perf_counters_test.nx
buildroot/runtime/_hdl_build/nx_perf_counters_test.nx
about
nx_perf_counters_test.nx -- validate the bits-up perf-counter reader in pure
NishiLang: open a hardware INSTRUCTIONS counter, run a known workload, read the
delta. A positive count proves we can measure real CPU activity DIRECTLY from
the silicon's PMU -- the STATE-INDEPENDENT energy foundation (works charging, on
AC, on a battery-less server) -- with no libc, no `perf`, no C.
Known answer: instruction delta > 0 (and within a sane band of the work done)
-> exit 0. If perf_event_open is unavailable (locked-down kernel), it reports
the errno and exits non-zero loudly -- never silently faking a number.
dependencies 1 imports · 0 importers
imports: nx_perf_counters.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
| 23 | const PC_ITERS: i64 = 5000000 |
functions
| 13 | func _emit(name: *u8, v: i64) -> i64 called by 1: main |
| 25 | func main() -> i64 |