Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm-metadata] print summary table #2079

Merged
merged 5 commits into from
Feb 28, 2025

Conversation

yoshuawuyts
Copy link
Member

@yoshuawuyts yoshuawuyts commented Feb 28, 2025

This PR makes it so that wasm-tools metadata show now prints a summary table at the start of the output. Think of this as a table of contents for the rest of the output. My hope is that this will make it easy to get a rough sense of what is contained within a Wasm binary, even as we continue to surface more metadata from the more detailed views. Thanks!

Example

╭───────────┬──────────────────────────┬──────┬───────┬───────────┬────────────╮
│ KIND      ┆ NAME                     ┆ SIZE ┆ SIZE% ┆ LANGUAGES ┆ PARENT     │
╞═══════════╪══════════════════════════╪══════╪═══════╪═══════════╪════════════╡
│ component ┆ unknown(0)               ┆ 2.8M ┆  100% ┆ -         ┆ <root>     │
├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ module    ┆ rust_wasi_hello.wasm     ┆ 2.8M ┆  >99% ┆ Rust, C11 ┆ unknown(0) │
├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ module    ┆ wit-component:adapter:wa ┆ 5.6k ┆   <1% ┆ Rust      ┆ unknown(0) │
│           ┆ si_snapshot_preview1     ┆      ┆       ┆           ┆            │
├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ module    ┆ wit-component:shim       ┆ 1.0k ┆   <1% ┆ -         ┆ unknown(0) │
├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ module    ┆ wit-component:fixups     ┆ 232B ┆   <1% ┆ -         ┆ unknown(0) │
├╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌┼╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ component ┆ unknown(1)               ┆ 306B ┆   <1% ┆ -         ┆ unknown(0) │
╰───────────┴──────────────────────────┴──────┴───────┴───────────┴────────────╯

Copy link
Contributor

@pchickey pchickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think CI just needs you to bless the new output. Looks great!

@alexcrichton alexcrichton added this pull request to the merge queue Feb 28, 2025
Merged via the queue into bytecodealliance:main with commit 3a28853 Feb 28, 2025
31 checks passed
duffney pushed a commit to duffney/wasm-tools that referenced this pull request Mar 4, 2025
* [wasm-metadata] print a summary table

* [wasm-metadata] improve rendering of unknown items

* [wasm-metadata] finalize table

* [wasm-metadata] fix tests

* [wasm-metadata] fix tests
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.

3 participants