Command-line tools¶
Two utilities build alongside the library, by default in top-level builds
only (BLAKE3PP_BUILD_CLI).
blake3ppsum hashes files the way sha256sum does. blake3ppgen produces
reproducible test data at the speed of your disk. Both are built on the
library documented here, so they are also worked examples of it.
The help below is what the tools print. tools/gen-help-docs.py writes
it from documentation builds of the tools, and CI checks that it is
current. Two parts depend on the build or the machine and are shown as
placeholders:
- the core count a thread default picks up;
- the async I/O engines a build carries.
--no-asyncnames them fromblake3pp::compiled_io_engines():io_uringon Linux,ioring/iocpon Windows,gcd(gcd-writeon the write side) on macOS,aioon FreeBSD, andasyncwhere the platform has no async engine to turn off.
See the API reference for the introspection calls behind it.
blake3ppsum¶
Plain, keyed and derive_key hashing, extended output, and --check to
verify checksum lines it printed earlier.
--no-names prints the digest alone. --raw writes the output bytes
unencoded instead of hex, for one input. --seek N starts the output at
byte N of BLAKE3's extended output, so --seek N --length L prints
bytes N to N+L-1. These take the meanings b3sum gives them.
-v reports on stderr the settings the run took effect with: the
kernel the hasher selected and the threads, then for one input the path
it took (pipelined, sequential or a stream), the read rung it engaged
and the plan: the window, the read depth the plan asked for (a
synchronous rung serves it one read at a time) and the windows. For
several inputs it reports the context their batches shared; the read
rung is each file's own there and is not reported. --diag says what
limited a run; -v says what it ran with.
--arena MIB sets the window memory the files read at once share,
128 MiB by default. A single file then reads through the same context
as a batch, so the arena bounds its windows too; with --window it
bounds the file-window storage a run shares, for a machine with little
memory. The arena holds at least one file's reads (--qd windows of
--window bytes) and at most 256 windows; a request outside that is
raised or lowered, and the arena it got is said on stderr. Standard
input reads through --qd windows, so --arena does not apply to it,
nor to --no-async, --diag or --raw; with --threads 1 each file
is read sequentially through --qd windows, without a context.
--files-from FILE hashes the files FILE names, one per line, and
--files0-from FILE those it names in records ended by a NUL, as
find -print0 writes them; - reads the list from standard input. A
list of any length is read and hashed a batch at a time, except under
--trace, which hashes it as one batch. A list that cannot be opened
is a usage error (exit 2); a --check list that cannot be opened is a
failure of the work (exit 1). In a newline
list one trailing carriage return is dropped and empty lines are
skipped; in a NUL list an empty record is an error. --zero (-z)
ends each output line with a NUL instead of a newline and writes names
unescaped, and with --check reads list records ended by a NUL, so a
list written with --zero verifies with --check --zero.
Checksum lines use the sha256sum and b3sum format, so --check also
reads lists written by those tools: the hex digest, one space, a space
or *, and the name to the end of the line. A name holding a backslash,
a newline or a carriage return is written as \\, \n and \r on a
line that starts with \, and --check reads it back the same way.
Lines with CRLF endings verify. --check reports malformed lines,
files that could not be read and mismatched digests in separate counts,
and fails a list that holds no well-formed line.
--quiet leaves out the OK lines. --status leaves out every verdict
line and warning, so the exit status alone reports the result; why a
listed file could not be read is printed either way. --ignore-missing
skips a listed file that does not exist, and fails a list none of whose
files was verified.
Names are UTF-8 on every platform. On Windows both tools run with UTF-8 as the process code page (Windows 10 version 1903 and later), so a name on the command line or in a list may hold any character, and a list written on one platform verifies on another.
Print or check BLAKE3 checksums.
With no FILE, or FILE of '-', read standard input.
blake3ppsum [OPTIONS] [files...]
POSITIONALS:
files TEXT ... files to hash (or checksum lists)
OPTIONS:
-h, --help Print this help message and exit
--version Display program version information and exit
-c, --check Excludes: --files-from --files0-from --no-names --raw --seek
read checksum lines from FILEs and verify them
--quiet Needs: --check
with --check: print no line for a file that verified
--status Needs: --check
with --check: print no verdicts or warnings; the exit status says
whether everything verified
--ignore-missing Needs: --check
with --check: skip listed files that do not exist; a list with no
file verified fails
--keyed TEXT Excludes: --derive-key
keyed (MAC) mode; FILE holds the 32-byte key as raw bytes or 64
hex chars ('-' reads it from stdin)
--derive-key TEXT Excludes: --keyed
key-derivation mode with this context string
--length UINT:UINT in [1 - 1048576] [32]
output length in bytes (extended output)
--seek UINT Excludes: --check
start the output at this byte of the extended output
--no-names Excludes: --check
print the digest alone, without the file name
--raw Excludes: --arena --check --files-from --files0-from --zero
write the output bytes unencoded instead of hex; one input only
--files-from TEXT Excludes: --check --files0-from --raw
hash the files FILE names, one per line ('-' reads the list from
standard input)
--files0-from TEXT Excludes: --check --files-from --raw
hash the files FILE names, each ended by a NUL ('-' reads the
list from standard input)
-z, --zero Excludes: --raw
end each output line with a NUL instead of a newline and write
names unescaped; with --check, read list records ended by a NUL
--arch ENUM:value in {auto, avx512, avx2, sse42, sve2_512, sve512, sve2_256, sve256, sve2_128, neon, sve128, rvv512_zvbb, rvv512, rvv256_zvbb, rvv256, rvv128_zvbb, rvv128, xthead, vsx, vxe, msa, lasx, lsx, simd128, scalar} [auto]
pin a SIMD variant
--threads UINT:THREADS [<cores>]
compute threads (1 = sequential; default: all)
--window UINT:MiB [8]
I/O window size in MiB
--arena UINT:MiB Excludes: --diag --no-async --raw
window memory, in MiB, shared by the files read at once (default:
128 MiB); at least --qd windows of --window bytes
--qd UINT [4] I/O queue depth (the reader clamps it to its range)
--no-direct keep the OS page cache (no O_DIRECT)
--no-async Excludes: --arena
read synchronously (no <this build's async engines> queue)
--inline-submit issue reads inline in the submitting thread, not on io_uring's
workers
--no-ioring Windows: read through the completion port instead of the I/O ring
--trace TEXT record per-window timing and write it as Chrome trace JSON to
PATH (open in ui.perfetto.dev)
--trace-agents Needs: --trace
with --trace: also record each pool agent's part of every window
-v, --verbose report on stderr the settings the run took effect with: the
kernel, the threads, and for one input its path, read rung and
plan
--diag Excludes: --arena
report on stderr which side limited the run (the hash, the
device, or the window arena between them); one FILE or '-', on
the pipelined path
blake3ppsum big.iso # multi-core, direct-I/O
blake3ppsum --keyed key.hex manifest/* > sums && blake3ppsum --keyed key.hex -c sums
blake3ppsum --derive-key "backup 2026 v1" --length 64 master.key
blake3ppgen¶
A deterministic, seekable byte-stream generator built on extended
output. One seed always yields the same stream, and --seek is O(1), so
materializing a slice at offset 10 GB costs what a slice at offset 0
costs.
--verify FILE compares a file with the stream instead of writing it,
so a storage test needs no second copy of its data: the seed, the
context and --seek name the stream, and file byte 0 is stream byte
--seek. It prints FILE: OK, or the first offset at which the file
differs together with that byte's offset in the stream, and exits 1 on
a difference or a read error. Without --length the file's own size is
checked; with it, a file that is shorter or longer fails.
Deterministic seekable byte stream from BLAKE3 extended output.
The same seed always yields the same stream; --seek is O(1).
blake3ppgen [OPTIONS]
OPTIONS:
-h, --help Print this help message and exit
--version Display program version information and exit
--seed TEXT Excludes: --seed-file
seed string
--seed-file TEXT Excludes: --seed
read seed bytes from FILE
--derive-key TEXT domain-separate the stream with this context string
--length TEXT [inf]
bytes to emit: N, NK/NM/NG/NT, or 'inf'
--seek TEXT [0] starting offset in the stream
--hex Excludes: --output --verify
emit lowercase hex instead of raw bytes
--output TEXT Excludes: --hex --verify
write to FILE via direct async I/O (io_uring or IOCP where
available) instead of stdout
--verify TEXT Excludes: --hex --output
compare FILE with the stream instead of writing it: report the
first offset that differs; without --length, check the file's
whole size
--no-direct Needs: --output
with --output: no direct I/O (write through the page cache)
--no-async Needs: --output
with --output: write synchronously (no <this build's async
engines> queue)
--inline-submit Needs: --output
with --output: issue writes inline in the submitting thread, not
on io_uring's workers
--no-ioring Needs: --output
with --output, Windows: write through the completion port instead
of the I/O ring
--waive-zero-fill Needs: --output
with --output, Windows: set the valid data length up front
instead of writing a sparse file (needs the volume-maintenance
privilege; exposes stale disk blocks until written)
--trace TEXT Needs: --output
with --output and --length, on the pipelined path: record
per-window timing and write it as Chrome trace JSON to PATH (open
in ui.perfetto.dev)
--trace-agents Needs: --trace
with --trace: also record which CPU filled each window, and for
how long
--diag Needs: --output
report on stderr which side limited the run (the generator or the
device); needs --output and --length on the pipelined path
--window UINT:MiB Needs: --output
with --output: write buffer size in MiB (default: 8 MiB with
--threads 1; otherwise 4 MiB with --length, or without it 4 MiB
per generator thread up to 64 MiB)
--qd UINT Needs: --output
with --output: write buffers in flight (default: one per
generator thread with --length and more than one thread,
otherwise 2; the writer clamps it to its range)
-v, --verbose report on stderr the kernel, the threads and the engaged write
backend
--threads UINT:THREADS [<cores>]
generator threads (1 = sequential; default: all)
blake3ppgen --seed run42 --length 1G > testdata.bin
blake3ppgen --seed run42 --seek 10G --length 1M > slice.bin # instant
blake3ppgen --seed run42 --length 100G --output fixture.bin # device-bound
blake3ppgen --seed run42 --length 32G --output f.bin --window 64 --qd 8
Where the time goes¶
Generation runs lanes-parallel in the kernel, and --threads fans
segments across cores using that same O(1) seek, which leaves the sink as
the bottleneck.
--output removes the sink as well: the stream is generated straight into
the write buffers and leaves through the platform's own direct path,
bypassing the page cache.
| OS | writer |
|---|---|
| Linux | io_uring + O_DIRECT |
| Windows | IoRing (Windows 11) or IOCP + no buffering |
| macOS | GCD + F_NOCACHE |
| FreeBSD | POSIX AIO on a kqueue + O_DIRECT |
--no-direct, --no-async, --inline-submit and, on Windows,
--no-ioring switch those off one at a time.
Tracing¶
Both tools record their run as Chrome trace JSON with --trace PATH (and
--trace-agents). blake3ppsum records the files it hashes; several
files hashed together show their windows across the context's window
objects. Its trace storage is sized from the FILE arguments, so standard
input gets two window records and the rest are counted as dropped.
blake3ppgen records its pipelined write path, each window's queue,
fill, write and release. The knobs a trace settles are --window,
--qd, --threads, --no-direct and --inline-submit, with the same
names on both tools and the same pipeline underneath. blake3ppgen -v
names the write backend that was engaged, and --diag
(below) reads a run's counters.
blake3pp_bench_file takes --no-async as well, which is how the
platform's async engine gets measured against its synchronous rung on
one device: the same windows, the same queue depth, served by pread
(ReadFile on Windows) instead. Its help text names the engines the
same derived way the other two do.
To see where a run's time actually goes, point blake3pp_bench_file at
the same file with the same flags and add --trace:
blake3ppsum --window 32 --qd 16 big.iso
blake3pp_bench_file big.iso --window 32 --qd 16 --trace t.json --trace-agents
It prints a per-window summary and writes the run as a Chrome trace. The
summary gives the wait/hash/absorb/release shares, the driver's own busy
fraction, and with --trace-agents an effective rate per CPU.
Performance tracing explains the records, the summary and
the trace file, and Where a window's time goes
has the bench's remaining rows.
Diagnosing a run¶
--diag reports which side of the pipeline constrained the run that just
finished, from the counters in driver_stats
(see Performance tracing). The reading itself is
blake3pp::diagnose_read() and blake3pp::diagnose_write() in
<blake3pp/trace.hpp>, which any caller can use on its own runs; see
Asking the library. The tools add the
formatting.
$ blake3ppsum --diag big.iso
diagnosis: device-limited
pool busy 2.0% of 16 threads
arena 6 of 16 windows in flight, 8 MiB each (128 MiB), wider than the queue depth of 4
in flight 4 x 8 MiB = 32 MiB outstanding at the device
device 16.082 ms per window over 256 reads (min 7.122 ms, 4.0 of 4 queued)
the pool had a window whenever it wanted one and still did not saturate, and the device's queue was full at 32 MiB outstanding: it is the wall at this geometry.
Four figures and a reading.
- Pool busy — the compute pool's share of its own capacity.
- Arena — the window objects the plan allocated, and whether they outnumber the queue depth. The windows beyond the reads are what the pool draws on while the device serves the next ones.
- In flight — the queue depth times the window. This is what the device was answering, and a device's rate depends on it, so read the verdict as a statement about this geometry rather than about the device.
- Device — the mean time a transfer spent at the device, the shortest such time, and how full its queue was. The mean needs the minimum beside it, because a queue's latency rises with its depth by construction.
| reading | what it means |
|---|---|
hash-limited |
the pool was saturated; no I/O geometry moves it |
device-limited |
the pool had a window whenever it wanted one, did not saturate, and the device's queue was full at the bytes in flight |
arena-limited |
neither end was busy and the run held every window it had, with the arena no wider than the queue |
in-flight-limited |
neither end was busy, the arena was wider than the queue, and the device served every read as if it were alone |
generator-limited |
writing: the windows spent more of the run being filled than being written |
Where a figure sits inside the band that separates two readings, no label is given: the report names both candidates and prints the figures.
$ blake3ppsum --diag --no-direct --threads 2 big.iso
diagnosis: hash-limited
pool busy 96.3% of 2 threads
arena 16 of 16 windows in flight, 8 MiB each (128 MiB), wider than the queue depth of 4
in flight 4 x 8 MiB = 32 MiB outstanding at the device
device 1.829 ms per window over 256 reads (min 838.5 us, 2.6 of 4 queued)
the pool was saturated: the hash is the constraint and I/O geometry will not move it.
$ blake3ppsum --diag --no-direct --window 8 --qd 16 big.iso
diagnosis: arena-limited
pool busy 41.0% of 16 threads
arena 16 of 16 windows in flight, 8 MiB each (128 MiB), no wider than the queue depth of 16
in flight 16 x 8 MiB = 128 MiB outstanding at the device
device 3.084 ms per window over 256 reads (min 633.8 us, 10.9 of 16 queued)
the pool idled waiting for a window while the device was not queued.
in-flight-limited has not been seen on real hardware so far. It is
asserted against the test suite's synthetic device, which models what would
produce it: a device that reports slowly and serves quickly, so that no
transfer ever queues behind another. More windows would not help such a
run; the lever would be the depth or the window.
On the write side the arena and the depth are one number: a window is a fill task, so the windows in flight are the generator's parallelism and the device's queue together. That leaves two readings, and the report names the direction.
$ blake3ppgen --seed s --length 2G --output out.bin --diag
diagnosis: device-limited (write side)
generator 2.8% of the 16 windows in flight (2.8% of 16 threads)
windows 16 in flight, 4 MiB each (64 MiB); the arena and the depth are one number here
device 15.083 ms per window over 512 writes (min 1.301 ms), holding 93.9% of the windows, 16 at a time
the device held a full queue for the run: it is the wall.
--diag describes a single run on the pipelined path. blake3ppsum
takes exactly one FILE or -, not --check, and more than one thread;
a FILE below the pipeline's minimum size is hashed sequentially and has
nothing to report. blake3ppgen needs --output, --length and more
than one thread. A run too short to turn its queue over four times
reports that instead of a reading. Where the engine holds fewer
transfers than the queue depth, an extra line gives the engine's count
and each transfer's wait for a slot.
On - the device is the stream: a producer that cannot keep up reads as
device-limited. Lines below the diagnosis give the stream's windows and
how many ended early because the producer ran dry (where early hand-over
is on), the pipe buffer the OS granted, what the stream watch did (where
the platform watches the stream), and on Windows the bound on a read's
ask.
The captures above are from a 16-thread Zen 5 machine under WSL2, on its
virtual disk, through the page cache where --no-direct appears.
The allocator¶
For the tools (blake3ppsum, blake3ppgen, benchmarks),
mimalloc is the default
allocator on every supported target (BLAKE3PP_TOOL_MIMALLOC, off by
default for wasm and macOS, and forced off in sanitizer builds).
The library itself stays allocator-neutral.