feat(benchmarks): add GasTrace qualitative gas profiler - #33
Merged
Merged
Conversation
Adds a reply-linked message tree reconstructor for `gtest::BlockRunResult`
to complement the existing quantitative `MeasureGas` / `BenchStorage` tools.
- `GasTrace` builder merges logs and `gas_burned` across one or more blocks,
groups replies by `reply_to`, surfaces events as top-level, and renders a
gas-annotated ASCII tree via `Display`.
- `MethodRegistry` resolves `(InterfaceId, entry_id)` pairs back to
`Service::method` names using `ServiceMeta::{INTERFACE_ID, METHODS}`.
- gtest's `block.log()` surfaces replies and events but not the originating
request — `GasTrace` synthesizes a root for any `gas_burned` entry whose
id isn't represented in the tree and nests its reply under it, so gas
attribution isn't silently dropped.
- Gated on the existing `gtest` feature (no impact when disabled).
- 16 unit tests (registry, tree reconstruction, display formatting, edge
cases) + 1 end-to-end integration demo against `access-control-test-app`.
Limitation documented in `GasTrace` rustdoc + README: cross-program
sub-calls (A -> B -> C) appear as separate roots because `gtest::CoreLog`
doesn't expose parent-message causality.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks done
vobradovich
self-requested a review
June 17, 2026 13:09
vobradovich
approved these changes
Jun 17, 2026
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.
Summary
Adds
GasTrace— a reply-linked message-tree reconstructor forgtest::BlockRunResult— toawesome-sails-benchmarks. It is the qualitative counterpart to the existingMeasureGas/BenchStoragequantitative tools: whereMeasureGasanswers how much gas?,GasTraceanswers where did the gas go?GasTracebuilder merges logs andgas_burnedacross one or more blocks, groups replies byreply_to, surfaces events as top-level entries, and renders a gas-annotated ASCII tree viaDisplay.MethodRegistryresolves(InterfaceId, entry_id)pairs back toService::methodnames usingServiceMeta::{INTERFACE_ID, METHODS}.block.log()surfaces replies and events but not the originating request —GasTracesynthesizes a root for anygas_burnedentry whose id isn't represented in the tree and nests its reply under it, so gas attribution isn't silently dropped.gtestfeature — zero impact when disabled.Example output
Limitations (documented)
Cross-program sub-calls (A → B → C) appear as separate roots because
gtest::CoreLogdoesn't expose parent-message causality. This is a gtest runtime constraint, not a tool design choice.Base branch
Based on
feat/awesome-sails-beta(which bumps tosails-rs = 1.0.0-beta.3) — gas_trace needsSailsMessageHeader,InterfaceId,MethodMetadata,ServiceMeta::{INTERFACE_ID, METHODS}, all of which are first published in the 1.0 beta line.Test plan
cargo check -p awesome-sails-benchmarks(default features)cargo check -p awesome-sails-benchmarks --no-default-features(gating verified)cargo check -p awesome-sails-benchmarks --features cli(bench-analyzer still builds)cargo test -p awesome-sails-benchmarks trace::tests— 16/16 unit tests passcargo test --release -p awesome-sails-benchmarks -- --include-ignored— 27/27 pass (incl. integration demo againstaccess-control-test-app)cargo clippy -p awesome-sails-benchmarks --all-targets --all-features -- -D warnings— cleancargo fmt --all --check— clean🤖 Generated with Claude Code