code wiki / _hdl_build / nx_energy_probe_test.nx

nx_energy_probe_test.nx

buildroot/runtime/_hdl_build/nx_energy_probe_test.nx

4362 B89 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic energy
docsdependenciesstructsconstsfunctions

about

nx_energy_probe_test.nx -- exercise the real-hardware probe end to end: detect the node's energy source, measure a fixed workload's real consumption in that source's native unit, and report HONESTLY (joules only from a joule source; cycles labeled as the speed proxy when no power sensor exists). This is the "real hardware, any hardware" half of the triangle -- on a RAPL/battery node it yields real energy; on a bare node it falls to the universal cycle counter. Known answer: detection returns a usable source (never NONE) AND the live counter advances over real work. exit 0.

dependencies 1 imports · 0 importers

nx_energy_probe.nx nx_energy_probe_test.nx

imports: nx_energy_probe.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main _puts ep_detect ep_file_readable sys_openat_rd sys_close ep_psu_discharging ep_read_first_char sys_openat_rd ↻ sys_mmap sys_read sys_close ↻ ep_psu_power_uw ep_read_decimal_file sys_openat_rd ↻ sys_mmap ↻ sys_read ↻ sys_close ↻ ep_src_name _emit ep_is_power_source ep_psu_power_uw ↻ sys_now_us sys_mmap ↻ sys_clock_gettime_mono ep_workload ep_read ep_read_decimal_file ↻ ep_is_joule_source ep_psu_present ep_file_readable ↻

structs

none

consts

13const EP_ITERS: i64 = 2000000

functions

16func ep_workload(seed: i64) -> i64
called by 1: main
23func _emit(name: *u8, v: i64) -> i64
called by 1: main
32func _puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main
34func main() -> i64