Commit a95057c
authored
Add
* Add `Component::{text,address_map,functions}` methods
These are similar to the methods with the same names on `Module`.
Also publicly export `ModuleFunction`, since it is returned by
`Module::functions` (and now also `Component::functions`).
Also publicly re-export `StaticModuleIndex` and `FuncIndex`, since they appear
inside `ModuleFunction`.
* Add `wasmtime hot-blocks` subcommand
This commit adds a new `wasmtime hot-blocks` subcommand that profiles Wasm
execution using `perf` and identifies the hottest basic blocks in the compiled
Wasm code.
Example output:
```
$ cargo run -- hot-blocks -F 999 -p 100 tests/all/cli_tests/fib.wat
`fib` :: block 0x16 :: 81.62% total samples
[Samples] [Assembly] [CLIF] [Wasm]
14.07% add esi, 1 - -
21.29% lea ecx, [rax + rdi] v14 = iadd.i32 v13, v12 i32.add
13.29% mov rdi, rax " "
17.64% mov rax, rcx " "
15.33% jmp 0xe jump block3(v18, v13, v14) br $loop
`fib` :: block 0x0 :: 18.33% total samples
[Samples] [Assembly] [CLIF] [Wasm]
18.33% cmp esi, edx brif v11, block2, block5 br_if $break
jae 0x2a " "
`wasm[0]::function[1]` :: block 0x37 :: 0.04% total samples
[Samples] [Assembly] [CLIF] [Wasm]
0.04% add ebx, 1 - -
jmp 0x6b jump block3(v14) br $loop
```
* Use RunCommon helpers and forward run flags in hot-blocks
Replace direct CommonOptions usage with RunCommon, using its load_module
helper and RunTarget enum to deserialize the compiled cwasm. This avoids
duplicating the module/component detection and deserialization logic.
Forward --dir, --env, -Wunknown-imports-trap, and -Wunknown-imports-default
flags through to the nested `perf record` subprocess so the profiled
execution honors WASI directory preopens, environment variables, and unknown
import handling.
* Fix `hot_blocks_fib` test on CI
* Address review feedback
* Fix clippy
* Don't bother running `wasmtime hot-blocks` unit tests under MIRIwasmtime hot-blocks subcommand (#13077)1 parent 80be8d6 commit a95057c
11 files changed
Lines changed: 1517 additions & 137 deletions
File tree
- src
- bin
- commands
- tests/all
- cli_tests
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
478 | 479 | | |
479 | 480 | | |
480 | 481 | | |
| 482 | + | |
481 | 483 | | |
482 | 484 | | |
483 | 485 | | |
| |||
620 | 622 | | |
621 | 623 | | |
622 | 624 | | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
623 | 630 | | |
624 | 631 | | |
625 | 632 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
93 | 97 | | |
94 | 98 | | |
95 | 99 | | |
| |||
130 | 134 | | |
131 | 135 | | |
132 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
133 | 140 | | |
134 | 141 | | |
135 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
0 commit comments