code wiki / _hdl_build / _cl_probe.nx
_cl_probe.nx source
↩ module page · 28 lines · 1083 B
1// _cl_probe.nx -- trace the regen scan loop on the KAT journal (per-line: offset, is_entry, idx, hash)
2import "nx_capreg_librarian.nx"
3import "nx_syscalls.nx"
4
5func main() -> i64 {
6 let jp: *u8 = "/tmp/_cl_journal_kat.log" as *u8
7 let lenp: *i64 = sys_mmap(16) as *i64
8 let b: *u8 = sys_read_file(jp, lenp)
9 let n: i64 = lenp[0]
10 cl_w(1, "file n=" as *u8); cl_wn(1, n); cl_w(1, "\n" as *u8)
11 var i: i64 = 0
12 while i < n {
13 let e: i64 = cl_line_end(b, i, n)
14 cl_w(1, "line i=" as *u8); cl_wn(1, i)
15 cl_w(1, " e=" as *u8); cl_wn(1, e)
16 cl_w(1, " is_entry=" as *u8); cl_wn(1, cl_is_entry(b, i, n))
17 cl_w(1, " idx=" as *u8); cl_wn(1, cl_parse_int(b, i + 11, n))
18 let j: i64 = cl_digits_end(b, i + 11, n)
19 cl_w(1, " j=" as *u8); cl_wn(1, j)
20 cl_w(1, " h=" as *u8); cl_wn(1, cl_hash_range(b, j, e))
21 cl_w(1, "\n" as *u8)
22 i = e + 1
23 }
24 let r: i64 = cl_regen(jp, "/tmp/_cl_live_probe.log" as *u8)
25 cl_w(1, "regen=" as *u8); cl_wn(1, r); cl_w(1, "\n" as *u8)
26 sys_exit(0)
27 return 0
28}