Skip to content

Features/correctness iteration#2

Merged
UnityZappy merged 3 commits into
mainfrom
features/correctness-iteration
Jun 1, 2026
Merged

Features/correctness iteration#2
UnityZappy merged 3 commits into
mainfrom
features/correctness-iteration

Conversation

@UnityZappy

Copy link
Copy Markdown
Collaborator

Add golden validation and MemoryProfiler summary-page metrics.
Extend the snapshot exporter to compute and validate the Unity Memory Profiler "Summary" page numbers, and add supporting snapshot decoding, reporting, and batch tooling.

Summary metrics

  • SummaryMetricsCalculator replicates EntriesMemoryMap (build/sort/post-process), GetPointType classification, and the AllMemory/Managed summary builder heuristics (legacy untracked fallback, graphics estimation, map-resolved VM-root reassignment).
  • Export the Allocated Memory Distribution and Managed Heap Utilization breakdowns plus totals to a new summary_metrics table (DuckDB + SQLite).

Golden validation

  • GoldenValidationRunner compares an exported DB against golden JSON (AssetBundle/SerializedFile/Remapper plus all summary categories), with committed/resident tolerances and a CLI validate command.
  • Add the com.unity.memory-snapshot-data-tools Unity package, whose editor GoldenValueExtractor reads golden values straight from the Memory Profiler's own summary model builders.
  • scripts/validate-golden.sh exports + validates in one step for CI.

Snapshot decoding fixes/additions

  • Correct ProfileTarget_Info/_MemoryStats entry IDs (59/60, not 64/65) so TargetMemoryStats decodes; read SystemMemoryRegions_Type as ushort so Mapped/Device regions classify correctly.
  • Decode managed heap section types, target memory stats, and per-type static field bytes; crawl static-field roots so statically reachable managed objects are discovered.
  • Add SnapMetadataReader, SnapProfileTargetInfoParser, CaptureMetadata, ResidentMemoryCalculator, and MemoryMapResidentAggregator.

Reports, batch export, CLI, docs

  • Multi-snapshot HTML report (builder, renderer, session grouping).
  • BatchExportRunner/ExportRunner and batch-export CLI command.
  • Document the .snap binary format (docs/snap-file-format.md); update the report skill and mkdocs nav.
  • Tests for golden validation, summary metrics, resident memory, batch export, and session grouping.

Add summary CLI command for high-level memory reports
Print a MemoryProfiler-style memory summary for a snapshot or an exported database directly to the console, without generating a database.

  • summary <input> accepts a .snap snapshot or a .duckdb/.db database. Snapshots run the same extraction pipeline as export/validate (SnapshotBridge) and read the computed SummaryMetrics; databases read the snapshot_info and summary_metrics tables via the golden-validation queries.
  • SummaryReportFormatter renders capture metadata, Total Allocated/Resident, and the Allocated Memory Distribution + Managed Heap Utilization breakdowns as aligned text ("—" where resident size is unavailable).
  • Always reports progress and total duration (not just under --verbose); snapshot decode progress is surfaced via a forcing progress wrapper.
  • When a database predates summary_metrics, print a runnable re-export example using the snapshot path recorded in snapshot_info.
  • Tests for the formatter (metadata/totals/breakdowns, unavailable resident, missing-summary notice).

Also fill in docs/intro.md with the project description and support contact.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

UnityZappy and others added 2 commits May 31, 2026 14:48
Extend the snapshot exporter to compute and validate the Unity Memory Profiler "Summary" page numbers, and add supporting snapshot decoding, reporting, and batch tooling.

Summary metrics
- SummaryMetricsCalculator replicates EntriesMemoryMap (build/sort/post-process), GetPointType classification, and the AllMemory/Managed summary builder heuristics (legacy untracked fallback, graphics estimation, map-resolved VM-root reassignment).
- Export the Allocated Memory Distribution and Managed Heap Utilization breakdowns plus totals to a new summary_metrics table (DuckDB + SQLite).

Golden validation
- GoldenValidationRunner compares an exported DB against golden JSON (AssetBundle/SerializedFile/Remapper plus all summary categories), with committed/resident tolerances and a CLI `validate` command.
- Add the com.unity.memory-snapshot-data-tools Unity package, whose editor GoldenValueExtractor reads golden values straight from the Memory Profiler's own summary model builders.
- scripts/validate-golden.sh exports + validates in one step for CI.

Snapshot decoding fixes/additions
- Correct ProfileTarget_Info/_MemoryStats entry IDs (59/60, not 64/65) so TargetMemoryStats decodes; read SystemMemoryRegions_Type as ushort so Mapped/Device regions classify correctly.
- Decode managed heap section types, target memory stats, and per-type static field bytes; crawl static-field roots so statically reachable managed objects are discovered.
- Add SnapMetadataReader, SnapProfileTargetInfoParser, CaptureMetadata, ResidentMemoryCalculator, and MemoryMapResidentAggregator.

Reports, batch export, CLI, docs
- Multi-snapshot HTML report (builder, renderer, session grouping).
- BatchExportRunner/ExportRunner and batch-export CLI command.
- Document the .snap binary format (docs/snap-file-format.md); update the report skill and mkdocs nav.
- Tests for golden validation, summary metrics, resident memory, batch export, and session grouping.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Print a MemoryProfiler-style memory summary for a snapshot or an exported database directly to the console, without generating a database.

- `summary <input>` accepts a .snap snapshot or a .duckdb/.db database. Snapshots run the same extraction pipeline as export/validate (SnapshotBridge) and read the computed SummaryMetrics; databases read the snapshot_info and summary_metrics tables via the golden-validation queries.
- SummaryReportFormatter renders capture metadata, Total Allocated/Resident, and the Allocated Memory Distribution + Managed Heap Utilization breakdowns as aligned text ("—" where resident size is unavailable).
- Always reports progress and total duration (not just under --verbose); snapshot decode progress is surfaced via a forcing progress wrapper.
- When a database predates summary_metrics, print a runnable re-export example using the snapshot path recorded in snapshot_info.
- Tests for the formatter (metadata/totals/breakdowns, unavailable resident, missing-summary notice).

Also fill in docs/intro.md with the project description and support contact.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@UnityZappy UnityZappy requested a review from a team as a code owner June 1, 2026 15:22
@UnityZappy UnityZappy merged commit 3f27a83 into main Jun 1, 2026
1 check passed
@UnityZappy UnityZappy deleted the features/correctness-iteration branch June 1, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant