Reli documentation

April 29, 2026 · View on GitHub

A task-oriented index. Start here if you know what you want to do but don't know which command (or which doc) to reach for. Everything in this file links out to a dedicated doc or a section of the top-level README.

Getting started

Capture call traces (where time is spent)

Reli samples the call stack on a timer, so each trace reflects what the VM is doing over wall-clock time — including I/O, lock waits, and sleeps, not just on-CPU work. Aggregated across many samples, this shows where your code spends its time.

I want to...UseMore
Attach to a running processinspector:trace -p <pid>tracing/capturing-traces.md
Capture to a compact binary file for later analysis (recommended)inspector:trace -p <pid> -o trace.rbttracing/binary-trace-format.md
Trace many processes at once (e.g. a php-fpm pool)inspector:daemon -P <regex>tracing/capturing-traces.md
Live top-style aggregationinspector:top -P <regex>tracing/capturing-traces.md
Include C-level framesadd --with-native-tracetracing/advanced-capture.md
See the opcode in phpspy text output (.rbt records it unconditionally)--output-format=template:phpspy_with_opcodetracing/advanced-capture.md
Resolve JIT-compiled function names in native tracesopcache.jit_debug=0x10 + --with-native-tracetracing/advanced-capture.md
Use phpspy as the fast C backend, with reli-driven ZTS supportphpspy:trace, phpspy:daemontracing/phpspy-hybrid.md
Attach a PHP variable to every sampleinspector:trace --trace-var=…inspection/trace-var-command.md

Analyse call traces

I want to...UseMore
Browse interactively in the terminal (recommended)rbt:explore trace.rbttracing/rbt-analyze-and-explore.md
One-shot text report (hot frames, callers/callees, live tail)rbt:analyze < trace.rbttracing/rbt-analyze-and-explore.md
Show the opcode at each framerbt:analyze --with-opcode, or press c in rbt:exploretracing/rbt-analyze-and-explore.md
Convert to speedscope / pprof / flamegraph / callgrind / foldedconverter:<format>tracing/binary-trace-format.md
Decode .rbt back to phpspy textconverter:phpspytracing/binary-trace-format.md
Recover a corrupted or truncated .rbt filerbt:recovertracing/binary-trace-format.md

Capture memory graphs (where memory is used)

A memory graph is reli's PHP heap reconstruction — values (objects, arrays, strings, call frames) as nodes, references as edges. Analysing a live process stops the target until the heap walk finishes; dumping the raw memory does not. In production, dump now and analyse later.

I want to...UseMore
Dump now (short stop), analyse offline (recommended)inspector:memory:dump -p <pid> -o dump.rdumpinspector:memory:analyze dump.rdump -f rmem -o snap.rmemmemory/memory-dump.md
One-shot live capture (longer stop, one command)inspector:memory -p <pid> -f rmem -o snap.rmemmemory/memory-profiler.md
From a core file (crashed / post-mortem)inspector:coredumpmemory/coredump.md

Tip: -f rmem (.rmem) is the fastest format and what the analysers below prefer. -f sqlite3 is also accepted by inspector:memory:report / inspector:memory:compare (handy if you already have SQLite tooling), -f json gives jq-friendly output, and -f report prints a findings report directly.

Analyse memory graphs

I want to...UseMore
Browse interactively in a TUI (recommended)rmem:explore snap.rmemmemory/rmem-explore-and-serve.md
Get a prioritised findings reportinspector:memory:report snap.rmem (or capture with -f report)memory/memory-report.md
Compare two graphs (regression / leak tracking)inspector:memory:compare before.rmem after.rmemmemory/memory-report.md
Emit a self-contained HTML viz (Pack / Treemap / Sunburst / 3D Force)rmem:viz snap.rmemmemory/rmem-explore-and-serve.md
Serve the viz over HTTP with a live focus bus (TUI ↔ browsers ↔ AI)rmem:live snap.rmem (or rmem:explore --http-bridge)memory/rmem-explore-and-serve.md
Run a persistent query server (JSON-over-socket)rmem:serve snap.rmemmemory/rmem-explore-and-serve.md
Let an AI assistant explore a graphrmem:mcpmemory/rmem-explore-and-serve.md
Query via raw SQL (snapshot must be SQLite, -f sqlite3)open the .db with sqlite3 / duckdb / any SQL toolmemory/memory-profiler-database.md

Monitor VMs

I want to...UseMore
Trigger an action when memory / a function / a variable condition matchesinspector:watchmonitoring/watch-command.md
Accept on-demand memory dumps from the app over a Unix socketinspector:sidecarmonitoring/sidecar.md

Inspect runtime variables

I want to...UseMore
Read a variable once (or poll it)inspector:peek-varinspection/peek-var-command.md
Attach a variable to every sample in a traceinspector:trace --trace-var=…inspection/trace-var-command.md

Advanced / tooling

I want to...UseMore
Just get the EG address (e.g. to feed phpspy manually)inspector:eg_address -p <pid>tracing/capturing-traces.md
Install phpspyphpspy:installtracing/phpspy-hybrid.md
Clear or bypass the binary analysis cachecache:clear, --no-cacheinternals/binary-analysis-cache.md

Platform notes

Internals / design notes

internals/ collects architecture notes, design docs, and post-mortem investigations — FFI CData lifetime, trace consistency, memory analysis performance, rmem serve design, watch command architecture, and others. Read these when you want to understand why reli is shaped the way it is, or when hacking on the internals.