Profiling

<- Back to Guide

Eta provides two runtime profiler modes:

CLI quickstart

Run sampled profiling (default) and write speedscope JSON:

eta prof run --out profile.speedscope.json path/to/program.eta

Run trace profiling and write an archive for later reporting/merge:

eta prof run --mode trace --format eta-prof --out run.eta-prof path/to/program.eta

Render reports from an archive:

eta prof report --format pretty run.eta-prof
eta prof report --format json run.eta-prof
eta prof report --format chrome run.eta-prof

Merge multiple runs:

eta prof merge --out merged.eta-prof run1.eta-prof run2.eta-prof

Open with speedscope:

eta prof view merged.eta-prof

eta prof run is a wrapper over eta run --prof .... You can use either form. etai also supports profiling directly with --prof, --prof-hz, --prof-format, and --prof-out.

CLI surface

eta prof subcommands:

eta prof run [--mode sample|trace] [--hz N] [--format FMT] [--out FILE] <file.eta|file.etac>
eta prof report [--format pretty|json|speedscope|chrome|pprof] FILE.eta-prof
eta prof merge --out OUT.eta-prof IN1.eta-prof IN2.eta-prof ...
eta prof view FILE.speedscope.json|FILE.eta-prof

Key eta prof run options:

Equivalent eta run flags:

eta run --prof[=sample|trace] [--prof-hz N] [--prof-format FMT] [--prof-out FILE] [run args...]

Notebook / Jupyter

eta_jupyter supports a %%prof cell magic that profiles one cell and renders an inline flamegraph.

%%prof [sample|trace] [--mode sample|trace] [--hz N]
<eta code...>

Examples:

%%prof
(+ 1 2)
%%prof trace
(fib 12)
%%prof --mode=sample --hz=4000
(workload)

The notebook output includes the cell result plus a profiler report (text/plain) and inline flamegraph HTML (text/html).

REPL

eta_repl supports a one-shot :prof meta-command that profiles the next submission.

:prof [sample|trace] [--mode sample|trace] [--hz N] [--format FMT]

Examples:

eta> :prof trace --format pretty
eta> (my-workload)
eta> :prof sample --hz 2000 --format json
eta> (my-workload)

Use :prof off (or :prof disable) to clear a pending request.

Formats

Supported report/export formats:

Report fields

pretty/json include flat and tree tables.

flat columns:

tree columns:

Notes:

std.prof

Import:

(import std.prof)

Exports:

mode accepts trace or sample (symbol or string).
format accepts pretty, json, speedscope, chrome, or eta-prof.