code wiki / (root) / nx_clock_full.nx

nx_clock_full.nx

buildroot/runtime/nx_clock_full.nx

2546 B74 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind librarytopic clock
docsdependenciesstructsconstsfunctions

about

nx_clock.nx -- sovereign wall-clock + monotonic time primitive. Replaces Python's time.perf_counter_ns() in bench harnesses. Calls the Linux clock_gettime syscall directly via __syscall. genealogy_id: posix_clock_gettime lineage_id: function

dependencies 1 imports · 1 importers

syscalls.nx nx_clock_full.nx nx_clock_test.nx

imports: syscalls.nx

imported by: nx_clock_test.nx

structs

42struct NxTimespec

consts

32const NX_SYS_CLOCK_GETTIME: i64 = 113 // Linux RISC-V syscall number
33const NX_CLOCK_REALTIME: i64 = 0 // clock_gettime clockid: wall time
34const NX_CLOCK_MONOTONIC: i64 = 1 // clock_gettime clockid: since-boot
37const NX_NS_PER_SEC: i64 = 1000000000 // 1e9 nanoseconds per second
38const NX_NS_PER_US: i64 = 1000 // 1e3 nanoseconds per microsecond
39const NX_NS_PER_MS: i64 = 1000000 // 1e6 nanoseconds per millisecond

functions

49func nx_clock_gettime(clock_id: i64) -> i64
58func nx_clock_realtime_ns() -> i64
62func nx_clock_monotonic_ns() -> i64
66func nx_clock_elapsed_us(start_ns: i64) -> i64
71func nx_clock_elapsed_ms(start_ns: i64) -> i64
called by 1: main calls 1: nx_clock_monotonic_ns