nx_ppdemo_serial.nx source
↩ module page · 15 lines · 576 B
1// nx_ppdemo_serial.nx -- a controlled SINGLE-THREADED compute workload (a tight arithmetic loop, no I/O) used
2// to validate nx_parallelism_probe: it should measure cpu/wall ~= 1.0 (one core, fully busy) and verdict
3// SINGLE-THREADED. This is the "codec that turned out serial" shape. license_tier: ORIGINAL expect_exit: 0
4import "nx_syscalls.nx"
5const K_MAGIC_3000000000: i64 = 3000000000
6
7func main() -> i64 {
8 var s: i64 = 0
9 var i: i64 = 0
10 while i < K_MAGIC_3000000000 {
11 s = s + ((i * 7) % 13)
12 i = i + 1
13 }
14 sys_exit(s % 7); return 0
15}