ppad-censor-0.6.0: Anytime-valid sequential constant-time testing.
Copyright(c) 2026 Jared Tobin
LicenseMIT
MaintainerJared Tobin <jared@ppad.tech>
Safe HaskellNone
LanguageHaskell2010

Censor.Runner

Description

Batteries-included harness support for Censor: meter selection from a command-line token, trace recording (built on runCTWith, so it does not reimplement the driver), and parameter sweeps.

Synopsis

Meter selection

data MeterChoice Source #

A meter chosen by name. The PMU variants carry their display label alongside the Counter.

Constructors

MeterWall 
MeterPMU !Counter !String 

parseMeter :: String -> Maybe MeterChoice Source #

Parse a meter name: wall, instructions, cycles, branches, ref-cycles, task-clock, branch-misses, or cache-misses.

meterName :: MeterChoice -> String Source #

The display name of a chosen meter.

withMeterArg :: Maybe String -> (String -> Meter -> IO a) -> IO a Source #

Parse a meter token (defaulting to wall-clock when absent) and run the callback with the resolved Meter and its name, bracketing a PMU counter for its lifetime and dying with a clear message if it cannot be opened (e.g. the PMU meters off Linux, or an unknown name). Handles the whole "wall everywhere, PMU Linux-only, hard error otherwise" dance in one place.

splitMeterName :: String Source #

The split meter's name on the command line and in reports (cycles+wall; see withSplitMeter).

withSplitMeterArg :: (SplitMeter -> IO a) -> IO a Source #

Run the callback with a SplitMeter, dying with a clear message if the cycle counter cannot be opened, as withMeterArg does.

Recording traces

data Trace Source #

A recorded run: the final Result plus the per-pair Frame trajectory.

Constructors

Trace 

Instances

Instances details
Show Trace Source # 
Instance details

Defined in Censor.Runner

Methods

showsPrec :: Int -> Trace -> ShowS #

show :: Trace -> String #

showList :: [Trace] -> ShowS #

record :: String -> String -> Meter -> Config -> Hypothesis a -> IO Trace Source #

Record a run, capturing every Frame via runCTWith. The observer strictly accumulates frames; the driver is runCTWith itself, not a reimplementation of it.

thin :: [Frame] -> [Frame] Source #

Downsample a frame list for compact plotting: keep all of the first 150 frames (the early motion), then a uniform stride, then the final frame.

Sweeps

sweep :: Meter -> Config -> (p -> IO (Hypothesis a)) -> [p] -> IO [(p, Result)] Source #

Run a parameterised family of hypotheses under one meter and return each parameter's result: the recurring "control vs swept input" pattern (a mismatch position, a length, ...).

Verdicts and rendering

verdictName :: Result -> String Source #

"REJECT" or "PASS".

shapeName :: LeakShape -> String Source #

The short label for a LeakShape, as it appears on a case row and in the advisories block of the JSON report.

summary :: Result -> String Source #

A one-line human-readable render of a Result, suitable for logging or embedding in a larger status line. Includes the verdict, pairs consumed, evidence (peak log e-value, p-value), effect interval, and clip count; on Reject it also names the driver channel of the hedge (leakShape).

REJECT after 342 pairs; driver=bulk peakLogW=18.42 p=1.0e-8
effect=[-101.5,-98.4] clipped=6/342

clipText :: Result -> String Source #

Render a Result's clipping as one field. The tight count is always shown; the wider bounds are appended only when clipping actually reached them, so the common case stays as terse as it was and a run whose effect interval saw truncated input says so.

clipped=6/342
clipped=129/138 (4c 44, 16c 3)