code wiki / _hdl_build / nx_perf_counters_test.nx

nx_perf_counters_test.nx

buildroot/runtime/_hdl_build/nx_perf_counters_test.nx

2938 B60 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic perf
docsdependenciesstructsconstsfunctions

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

nx_perf_counters.nx nx_perf_counters_test.nx

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

main pc_open_best pc_open2 sys_mmap _emit pc_read sys_mmap ↻ sys_read

structs

none

consts

23const PC_ITERS: i64 = 5000000

functions

13func _emit(name: *u8, v: i64) -> i64
called by 1: main
25func main() -> i64