aboutsummaryrefslogtreecommitdiffstats
path: root/research/experiments/029-across-machines/clock.py
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-02 06:21:48 +0100
committereunhhu <[email protected]>2026-10-02 06:21:48 +0100
commit2be6928a4367ff35209484becad6627e34ac9768 (patch)
treee3af41b1611cdc064607553f33f3b82106164ffc /research/experiments/029-across-machines/clock.py
parent28e51430cc860adc8d8f384d7662d85ab09dc5c7 (diff)
downloadpure-2be6928a4367ff35209484becad6627e34ac9768.tar.gz
pure-2be6928a4367ff35209484becad6627e34ac9768.zip
Run Pure and aup on an x86_64 WSL2 and an M3 Mac against the Pi (029)
Every pure-run of aup's check (1,053 runs of 667 modules) gives the same output, errors and exit on the Pi, the WSL2 (x86_64, 4 KiB pages, gcc 13) and the Mac (Apple clang 21); the same events make byte-identical stores on the Pi and the Mac, and either opens the other's and goes on the same. Pure's checks pass one at a time in WSL (each_check.py); its wall clock is set back about 2 s every 32 s (clock.py). stores.py streams pure-run's output, whose size grows with the square of the events.
Diffstat (limited to 'research/experiments/029-across-machines/clock.py')
-rw-r--r--research/experiments/029-across-machines/clock.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/research/experiments/029-across-machines/clock.py b/research/experiments/029-across-machines/clock.py
new file mode 100644
index 0000000..f65a21a
--- /dev/null
+++ b/research/experiments/029-across-machines/clock.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+"""Whether this machine's wall clock jumps (research 029): the wall clock
+(time.time) against the monotonic one, read every 20 ms for SECONDS; each
+step where the wall clock moved more than 20 ms apart from the monotonic
+one, how far, and when (also on the system's monotonic clock). A JSON line
+each, then one with the totals.
+
+clock.py SECONDS"""
+import json
+import sys
+import time
+
+seconds = float(sys.argv[1])
+start_wall, start_mono = time.time(), time.monotonic()
+wall, mono, jumps = start_wall, start_mono, 0
+while mono - start_mono < seconds:
+ time.sleep(0.02)
+ now_wall, now_mono = time.time(), time.monotonic()
+ apart = (now_wall - wall) - (now_mono - mono)
+ if abs(apart) > 0.02:
+ jumps += 1
+ print(json.dumps({'at_s': round(now_mono - start_mono, 2), 'monotonic': round(now_mono, 2),
+ 'wall_moved_ms': round((now_wall - wall) * 1000, 1),
+ 'monotonic_moved_ms': round((now_mono - mono) * 1000, 1)}), flush=True)
+ wall, mono = now_wall, now_mono
+drift = (time.time() - start_wall) - (time.monotonic() - start_mono)
+print(json.dumps({'seconds': seconds, 'jumps': jumps, 'wall_minus_monotonic_ms': round(drift * 1000, 1)}))