feat: trace export, HTML dashboards, and WASM profiling#36
Merged
Conversation
…rters Trace visualization export for Pirx simulations. Converts `&Trace` into Perfetto protobuf (for ui.perfetto.dev) and Chrome Trace Event Format JSON (for chrome://tracing). Pure data transformation — no file I/O, no engine dependency. Includes pool-aware track hierarchy, buffer counter tracks, factory slice/instant events, stall/decoder/routing visualization, and parameterized criterion benchmarks.
Wire pirx-export into the CLI as `pirx export`. Accepts a trace JSON file and exports to Perfetto protobuf or Chrome TEF format. Optional --hw flag provides factory pool names and calibrated cycle timing.
Deduplicate max_factory_id into a crate-level pub(crate) helper shared by both Perfetto and Chrome TEF exporters. Extract per-event conversion into a standalone convert_event function with explicit ChromeState, removing mutable borrows from the top-level loop. Add test for zero-cycle-time clamping and tighten lint allows.
Add an HTML report generator backed by Plotly.js (vendored) that produces self-contained, single-file dashboards for profile, monte-carlo, and compare commands. Each dashboard includes interactive charts for metrics like cycle counts, stall rates, buffer utilization, and cross-model comparisons. The Plotly library is embedded inline so the output works fully offline.
Ignore JSON output files produced by profile, monte-carlo, compare, and sensitivity commands so they don't get accidentally committed.
Expose read-only accessors for the most recently recorded trace event and the current simulation cycle. Propagates through EventSink, TraceCollector, and SampledTraceCollector. Streaming mode returns None (events are not stored). Enables step-by-step simulation consumers to observe engine state without accessing internal fields.
Thin wasm-bindgen wrapper over pirx-core, pirx-ir, and pirx-hw. Exposes one-shot profiling (streaming mode), Monte Carlo simulation (sequential, single-threaded), and a step-by-step WasmEngine for frame-by-frame animation. Excluded from workspace (separate wasm-pack build). Includes demo page, WASM tests, and Makefile targets (build-wasm, test-wasm, clean-wasm).
Fixes cargo-deny wildcard ban for unpublished workspace crate.
Drop criterion bench, [[bench]] section, and codspeed dev-dependency.
bytes 1.12.0 was published <7 days ago, failing CI freshness check.
Perfetto: validates non-empty output with correct protobuf field tag. Chrome TEF: validates JSON output contains traceEvents key.
Write raw trace JSON to disk for downstream `pirx export`. Uses full trace mode when saving; adds TraceUnavailable error for streaming-mode fallback. Includes demo-export Makefile target.
…perf()/etc.. Do the commit BUT YOU ARE NOT ALLOWED TO WRITE THE AUTHOR OF IT! Just clean commit
Introduce ProfileArgs, MonteCarloArgs, and CompareArgs structs to replace 8-parameter function signatures in CLI command handlers. Removes #[allow(clippy::too_many_arguments)] suppressions.
Propagate gate IDs into Chrome TEF args and Perfetto debug annotations so individual events are identifiable in trace viewers. Extract emit_factory_complete helper to deduplicate factory span emission. Harden HTML dashboards: escape </script> injection in embedded JSON, add single-quote entity escaping, remove dead distViolin helper. Fix u16 truncation in WASM factory_count (saturate instead of wrapping). Add engine accessor tests for last_event and current_cycle.
Replace single demo-export target with focused demo targets (demo-distillation, demo-perfetto, demo-real-circuit, demo-compare) outputting to demo-output/. Normalize Python targets to -py suffix. Remove redundant section comments. Restructure CHANGELOG to document trace export, WASM engine, HTML dashboards, and CLI improvements. Move sensitivity hardening entries under their original section.
TrackDescriptor had name (tag=4) and thread (tag=2) swapped relative to the official Perfetto track_descriptor.proto (name=2, thread=4). This caused Perfetto UI import errors due to wire-format field mismatches.
Scope CLI output artifacts to their crate directory, group coding tool entries together, and add AGENTS.md to ignored files.
Introduce EventSpec in Perfetto encoder, FactoryTrack in Chrome TEF encoder, and ExportArgs in the CLI export command to replace long positional parameter lists. Merge duplicate TraceCollector impl block and tighten last_event visibility to pub(crate). Remove unnecessary Clone/Copy derives on PoolDescriptor and ExportConfig.
Reject circuits exceeding 50,000 ops in step-by-step WasmEngine to prevent unbounded trace memory growth in the WASM heap. Remove unused js-sys dependency, mark crate as publish = false, and enable additional clippy lints (cast safety, needless clones, pass-by-value, etc.).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add trace visualization export (Perfetto protobuf + Chrome TEF), standalone interactive HTML dashboards for CLI commands, and a WASM crate for in-browser profiling.
Why
Pirx simulations produce rich traces but there was no way to visualize them outside of raw JSON. Users need to load traces into
Perfetto/Chrome DevTools for timeline analysis, generate offline-capable reports for sharing, and run simulations directly in
the browser for demos and lightweight exploration.
How
hierarchy, buffer counter tracks, factory slice/instant events, stall/decoder/routing visualization. No file I/O, no engine
dependency. Criterion benchmarks included.
calibrated cycle timing.
compare commands. Works fully offline.
step-by-step WasmEngine for frame-by-frame animation. Excluded from workspace (separate wasm-pack build). Includes demo page and WASM tests.
state.
Testing
make cipasses locally (fmt + clippy + test + audit)Checklist
unwrap()/expect()in production code