Reporters¶
- class mew.Reporter(*args, **kwargs)[source]¶
Bases:
ProtocolDuck-typed reporter interface consumed by the C++ runner.
Implementations must provide
report_contextandreport_runs;finalizeis optional. All callbacks run on the main thread with the GIL held.
- class mew.RichReporter(*, console=None, show_memory=False, show_cpu=False, show_label=False, show_variant=False)[source]¶
Bases:
objectStream one row per benchmark to a terminal as runs complete.
The header prints before any results land, so optional-column flags are passed up front.
- Parameters:
console (
Console|None) – Console to print to. Defaults to a fresh one.show_memory (
bool) – AddPeak Mem/Total Alloccolumns.show_cpu (
bool) – AddSamples/Hottest Framecolumns.show_label (
bool) – Add aLabelcolumn (the parametrize case id). Pass for families, where the case is otherwise indistinguishable from the truncated name.show_variant (
bool) – Add aVariantcolumn (the--variantname). Pass when rows from several variants stream into one table, so they stay distinguishable.
- class mew.JSONReporter(*, output=None)[source]¶
Bases:
objectEmit a single
{"context": ..., "benchmarks": [...]}document, GB-style.To a seekable sink (a file) it streams: writes context + empty array up front, then each
report_runs()seeks over the closing]}and re-writes it, so the file is valid JSON after every flush (survives Ctrl-C). A non-seekable sink (stdout, pipe) can’t be rewritten, so it buffers and writes once atfinalize().
- class mew.ParquetReporter(*, output, append=False)[source]¶
Bases:
objectWrite a Parquet file with one row per benchmark Run.
Static schema; user context goes in a JSON string column
custom(query viajson_extractin DuckDB).- Parameters:
- Raises:
RuntimeError – From
finalize()whenpyarrowis not installed.
- class mew.Fanout(reporters)[source]¶
Bases:
objectBroadcast reporter callbacks to a list of underlying reporters.
Used by
mew.run()to multiplex when multiple reporters are passed.report_contextreturnsall(...)of the children’s responses, so the strictest sub-reporter wins.