"""The one clock every ReDoS bound in this suite is measured against. Process CPU time, not wall clock: a ReDoS blowup is spent cycles, and a loaded machine steals wall clock without adding any. In 0.7.0 these bounds ran on ``time.monotonic()`` and two of them failed at 2.24s / 3.66s against a 2.0s bound while two census processes had the CPU; the same rows passed 3/3 on an idle machine. The scans had not slowed down — they were descheduled. This lives in its own module, imported by all six test files, rather than being copied into each. The suite already holds that rule for the code it measures ("never re-implement a predicate you measure — import it"), and it binds harder here: ``test_output.py::test_the_redos_clock_ignores_time_this_process_did_not_spend`` pins ONE implementation. Five copies would leave four of them unpinned and free to drift back to a wall clock without a single test going red. What this clock gives up: a scan that BLOCKS forever burns no CPU, so it would hang the suite instead of failing it. Acceptable for every caller here — these scanners are pure regex over an in-memory string, with no I/O and no locks, so the only way they can be slow is by spending cycles. It is also why ``test_output.py::test_pathological_input_returns_within_a_bound`` deliberately keeps a wall clock: that row claims to catch "a hang or a blowup", and only a wall clock catches the first. """ import time def scan_seconds(scanner, payload) -> float: """CPU seconds ``scanner(payload)`` cost. Pinned by ``test_the_redos_clock_ignores_time_this_process_did_not_spend`` in ``test_output.py``, which carries the measurements behind the choice. """ start = time.process_time() scanner(payload) return time.process_time() - start