open-standards/jcp/jcp-rs/crates/jcp-intercept
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Transaction Science 6d7bc256a5 jcp-intercept: a reading meter meters a seam as one span, divided among its steps by CPU time
Every interceptor step was metered as a span of its own. Where the meter
reads this process's energy count, each read first takes the reading
thread off its core (#229): tens of microseconds and its own wake-up. An
interceptor step is often a few microseconds, so a span of its own read
as mostly the meter, and a chain of k interceptors paid 2k reads per seam.

A meter that reads a counter now meters the whole seam pass as one span
(two reads per seam), and the steps are sealed after it closes, each with
its share of the reading by its own thread CPU time, which is exact and
read at no cost. The shares are integer micro-joules that sum to the
reading exactly (largest remainder); a share of a reading is ModelBased,
a pass of one step keeps the reading's own grade, and coverage is the
pass's. A meter that reads nothing (a model, a constant) still meters
each step on its own, so the receipts sealed with it are byte-identical.

jcp-energy exposes the thread CPU clock it already had
(`thread_cpu_time`). On the M3 Ultra, three steps burning 2, 4 and 8 ms
were sealed 10.8, 21.5 and 42.8 mJ, summing to the chain's figure and to
96-97% of an independent read around the pass, in 10 of 10 rounds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 02:41:41 -04:00
..
src jcp-intercept: a reading meter meters a seam as one span, divided among its steps by CPU time 2026-10-13 02:41:41 -04:00
tests jcp-intercept: a reading meter meters a seam as one span, divided among its steps by CPU time 2026-10-13 02:41:41 -04:00
Cargo.toml jcp-intercept: a reading meter meters a seam as one span, divided among its steps by CPU time 2026-10-13 02:41:41 -04:00