LedgerMath

View as Markdown

An event: one line of a Run's stdout

A benchmark prints a stream of events to its stdout, one JSON object per line; the events schema gives the shape of each line, and a Method counts a Run only when every line of its stdout has that shape.

Where it is

  • Address: the lines have no file of their own: they are the stdout blob a Run file names (stdout, sha256:<hex>), at https://api.ledgermath.com/blobs/sha256/<hex> (the table of contents' evidence.blob_url_template).
  • Reached from: a Run file's stdout.
  • The schema describes one line. The order of the lines is a rule of its own, which the schema states in words (below).
  • Schema: Event, served by the API.

What its schema says

One line of a benchmark's stdout.

A benchmark prints a stream of these, one JSON object per line, and nothing else on stdout. The six universal events below have exactly the fields listed. A benchmark may also emit events of its own, under any other name, with any fields beside event and t. A schema of one line cannot hold the stream's order, which is a rule of its own: started first and once, and in a stream that is recorded without quick: true; finished last and once; samples numbered from 0 in order, each starting only when none is open and at a t no earlier than the previous sample's sample_ended; every sample_ended closing the open sample, of the same number, at a t no earlier than its start, and every sample closed; each observed key once; exactly one verified; and at least one sample whose warmup is false.

Example

7 lines of the 418 of the stream at https://api.ledgermath.com/blobs/sha256/46cf012c4fb71b9e047b3a7a461aaa18d7ec915cdcbf5de2a626abd53bc93fa4 (161,116 bytes), the stdout of the Run at https://api.ledgermath.com/runs/2026/11/26/01a218b7-46f4-72cb-83d7-f2477c8b426e.json, as LedgerMath's fixed sample took it on 2026-11-26: the first line of each of the six universal events the stream holds, and the first of the benchmark's own events (name_resolved), each an excerpt the generator made.

{"event":"started","t":942987204450,"schema":"ledgermath.events/1","wall_utc":"2026-11-26T16:36:34.189221436Z","clock":"CLOCK_MONOTONIC_RAW","clock_read_ns":22.582,"quick":false}
{"event":"observed","t":943058211946,"values":{"tls_library":"AWS-LC 5.14.0","tls_library_source_sha256":"8895a9d2434e875e009e652a1015f9c2c275261634c7132253ca5aa60d266888"}}
{"event":"sample_started","t":943133129607,"sample":0,"warmup":true,"repetitions":1}
{"event":"name_resolved","t":943133319031,"request":0,"server":"172.31.0.2:53","name":"ledgermath-production-runs-fixturesbucketbucket-zkntsvnz.s3.us-east-2.amazonaws.com","reply_bytes":273,"rcode":0,"truncated":false,"answers":["ledgermath-production-runs-fixturesbucketbucket-zkntsvnz.s3.us-east-2.amazonaws.com. 159 CNAME s3-r-w.us-east-2.amazonaws.com."],"address":"52.219.92.58","cpu_ns":29533}
{"event":"sample_ended","t":943328708261,"sample":0}
{"event":"verified","t":959190657967,"checksum":"0xaa3a7e27c3b46660"}
{"event":"finished","t":959190668371}
What the excerpt leaves out, in 2 places

The excerpt is made by one rule, applied at every depth, and changes nothing else. A list of more than one element keeps its first, unless every element is a string, a number, true, false or null and the list takes at most 120 characters as JSON: then it is kept whole. An object keeps every member its schema names, but of members whose schemas are each nothing but a reference to one and the same definition (such as a request's eight phases), it keeps the first. Of an object's members whose names its schema does not fix, it keeps the first, then each next one while the values kept, as excerpted, take at most 300 bytes as JSON, and none after the first that does not fit. A string longer than 160 characters keeps its first 160 and ends with …

  • line 2.values: 2 of its 10 members whose names its schema does not fix
  • line 4.answers: its first element of 9

Fields

Each field is named by its path from the top of the line: a.b is the member b of the object a, [] stands for each element of a list, * for a member whose name is not fixed (its object's type says when the names must match a pattern), and a name with a dot in it is written ["p99.9"]. Under each path are its type and whether it is required (present wherever the object holding it is) or optional (it may be absent). An object said to have no other members holds none but those listed for it; any other object may hold members this page does not list. A benchmark may also print events of its own, under any name but the six below, with members this page does not list; and the keys of an observed event's values are the benchmark's own. The benchmark's page documents both: for example http_get.

event

string, not empty · required

The event's name: one of the six universal events, started, observed, sample_started, sample_ended, verified and finished, whose fields are fixed; or a benchmark's own, under any other name.

t

integer, 0 or more · required

Whole nanoseconds on the clock that started names.

When event is "started"

Always first.

It then has schema, wall_utc, clock and clock_read_ns, may have quick, and has no other member but event and t.

schema

always "ledgermath.events/1" · required

Which version of the stream's shape the binary prints.

wall_utc

string matching ^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{9}Z$ · required

The wall clock read straight after t, to the nanosecond.

clock

string, not empty · required

The clock every t is read from.

clock_read_ns

number, 0 or more · required

The median cost of one clock read, measured at startup.

quick

boolean · optional

True for a developer's trial stream, from the binary's quick mode.

The scheduled box never asks for quick mode; a runner told to run quick passes it on and still writes the Run, but no Method counts a Run whose stream says quick: true.

When event is "observed"

What the program observed about its own work. May appear more than once; each key appears once across all of them.

It then has values, and has no other member but event and t.

values

object · required

What the benchmark observed of its own run, by key, as the benchmark documents them: the counterparts of its parameters, and whatever else it records of the run (http_get's include the cost of a clock read, how many responses had each status, how many lines it withheld, and why it ended early).

Never a value merely read back from its environment. bytes_per_repetition, when present, is what bytes per second are derived from.

When event is "sample_started"

The start edge of one sample. Samples are numbered from 0 and never overlap.

It then has sample, warmup and repetitions, and has no other member but event and t.

sample

integer, 0 or more · required

The sample's number: from 0, in stream order.

warmup

boolean · required

True for a warmup sample: printed and tagged, never dropped, and not a counted sample, so neither one of the LM_SAMPLES samples the stream must hold nor among the samples a Method takes times from.

A benchmark's own counts in its observed values may include it: http_get's requests_made does.

repetitions

integer, 1 or more · required

How many repetitions of the measured work lie between the sample's two edges, 1 or more.

When event is "sample_ended"

The end edge of the sample with the same number.

It then has sample, and has no other member but event and t.

sample

integer, 0 or more · required

The number of the sample it closes: the open one.

When event is "verified"

A value derived from the data the measured work processed.

It then has checksum, and has no other member but event and t.

checksum

string matching ^0x[0-9a-f]{16}$ · required

The value, 0x and sixteen lower-case hex digits: derived from the data the measured work processed, so that a compiler cannot delete the work.

When event is "finished"

Always last. Its absence is evidence of a crash.

It then has no other member but event and t.