With batch ids in the trace, the digest gains a Largest GPU batches
section: for the longest GPU batch slices, the GPU ranges inside each and
the CPU slices carrying the same batch id, inclusive. --json carries it as
largest_gpu_batches. Traces without batch ids are digested as before.
On Windows, piped or redirected output uses the ANSI code page, so a
trace whose thread or slice names are not in cp1252 (a Japanese thread
name, for example) made the markdown digest stop with
UnicodeEncodeError after the work was done. stdout is now set to UTF-8
when the tool runs from the command line, as check_conventions.py does.
The --json output was not affected because json.dumps escapes non-ASCII.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012zyXkUzTZGh3nBwNMtrLaW
APS5_TRACE_SUMMARY_EVERY=<seconds> appends one line to aps5-summary.jsonl
every <seconds> seconds, at a present, from the per-scope totals the trace
threads already keep. No event buffer is allocated unless a window switch is
set as well; then the window records its full trace on top of the intervals
and its own summary line holds only the time inside the window. Each line has
the fields of the window summary line for its interval plus interval_start_s
and interval_end_s.
tools/trace_digest.py prints a summary file with interval lines as one row
per interval with a text sparkline of the frame p99 and the GPU busy time.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/trace_digest.py reads an APS5_TRACE_FRAMES capture (aps5-trace-*.json.gz)
and prints a markdown report of a few KB, or the same data as JSON: the
summary line from aps5-summary.jsonl, the slowest frames with their largest
slices, the busy, wait and untraced time of each thread, the largest slices
per frame, the longest waits, and with --stacks the hottest frames of an
APS5_SAMPLE_WORKER collapsed-stack file. Python standard library only; a
unittest checks every section on a small synthetic trace.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>