Add support for generating perf maps for simple perf profiling (#6030)
* Add support for generating perf maps for simple perf profiling * add missing enum entry in C code * bugfix: use hexa when printing the code region's length too (thanks bjorn3!) * sanitize file name + use bufwriter * introduce --profile CLI flag for wasmtime * Update doc and doc comments for new --profile option * remove redundant FromStr import * Apply review feedback: make_line receives a Write impl, report errors * fix tests? * better docs
This commit is contained in:
@@ -39,7 +39,7 @@ runtime--enable runtime support based on how you use Wasmtime:
|
||||
* **C API** - call the `wasmtime_config_profiler_set` API with a
|
||||
`WASMTIME_PROFILING_STRATEGY_VTUNE` value.
|
||||
|
||||
* **Command Line** - pass the `--vtune` flag on the command line.
|
||||
* **Command Line** - pass the `--profile=vtune` flag on the command line.
|
||||
|
||||
|
||||
### Profiling Wasmtime itself
|
||||
@@ -58,11 +58,11 @@ With VTune [properly installed][download], if you are using the CLI execute:
|
||||
|
||||
```sh
|
||||
$ cargo build
|
||||
$ vtune -run-pass-thru=--no-altstack -collect hotspots target/debug/wasmtime --vtune foo.wasm
|
||||
$ vtune -run-pass-thru=--no-altstack -collect hotspots target/debug/wasmtime --profile=vtune foo.wasm
|
||||
```
|
||||
|
||||
This command tells the VTune collector (`vtune`) to collect hot spot
|
||||
profiling data as Wasmtime is executing `foo.wasm`. The `--vtune` flag enables
|
||||
profiling data as Wasmtime is executing `foo.wasm`. The `--profile=vtune` flag enables
|
||||
VTune support in Wasmtime so that the collector is also alerted to JIT events
|
||||
that take place during runtime. The first time this is run, the result of the
|
||||
command is a results diretory `r000hs/` which contains profiling data for
|
||||
@@ -96,13 +96,13 @@ $ rustc --target wasm32-wasi fib.rs -C opt-level=z -C lto=yes
|
||||
```
|
||||
|
||||
Then we execute the Wasmtime runtime (built with the `vtune` feature and
|
||||
executed with the `--vtune` flag to enable reporting) inside the VTune CLI
|
||||
executed with the `--profile=vtune` flag to enable reporting) inside the VTune CLI
|
||||
application, `vtune`, which must already be installed and available on the
|
||||
path. To collect hot spot profiling information, we execute:
|
||||
|
||||
```sh
|
||||
$ rustc --target wasm32-wasi fib.rs -C opt-level=z -C lto=yes
|
||||
$ vtune -run-pass-thru=--no-altstack -v -collect hotspots target/debug/wasmtime --vtune fib.wasm
|
||||
$ vtune -run-pass-thru=--no-altstack -v -collect hotspots target/debug/wasmtime --profile=vtune fib.wasm
|
||||
fib(45) = 1134903170
|
||||
amplxe: Collection stopped.
|
||||
amplxe: Using result path /home/jlb6740/wasmtime/r000hs
|
||||
@@ -141,7 +141,7 @@ like:
|
||||
- Open VTune Profiler
|
||||
- "Configure Analysis" with
|
||||
- "Application" set to `/path/to/wasmtime` (e.g., `target/debug/wasmtime`)
|
||||
- "Application parameters" set to `--vtune /path/to/module.wasm`
|
||||
- "Application parameters" set to `--profile=vtune /path/to/module.wasm`
|
||||
- "Working directory" set as appropriate
|
||||
- Enable "Hardware Event-Based Sampling," which may require some system
|
||||
configuration, e.g. `sysctl -w kernel.perf_event_paranoid=0`
|
||||
|
||||
Reference in New Issue
Block a user