Skip to content

Commit 59f5fe2

Browse files
authored
Merge pull request #128 from wasmerio/docs-update-1000091c-9892-4479-be26-e4f7f4963386-20250422-143151
docs: Add WebAssembly profiling feature documentation
2 parents e55c9c2 + f22122a commit 59f5fe2

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

pages/runtime/cli.mdx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ You can also pass environment variables:
5959
wasmer run my_wasi_program.wasm --env MYVAR=MYVALUE -- arg1 arg2 arg3
6060
```
6161

62+
### Profiling WebAssembly Code
63+
64+
You can enable profiling data generation for your WebAssembly code using the `--profiler` option:
65+
66+
```bash copy
67+
wasmer run my_program.wasm --profiler=perfmap
68+
```
69+
70+
This generates profiling information in the [perfmap format](https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt), which can be used with Linux perf tools to analyze the performance of your WebAssembly code. The profiler data is written to `/tmp/perf-{PID}.map`.
71+
72+
This option is available for the Cranelift, LLVM, and Singlepass compiler backends.
73+
6274

6375
## Help
6476

@@ -135,6 +147,14 @@ Options:
135147
136148
Available for cranelift, LLVM and singlepass.
137149
150+
--profiler <PROFILER>
151+
Enable a profiler.
152+
153+
Available for cranelift, LLVM and singlepass.
154+
155+
Possible values:
156+
- perfmap: Generate profiling data in perfmap format
157+
138158
--llvm-debug-dir <LLVM_DEBUG_DIR>
139159
LLVM debug directory, where IR and object files will be written to.
140160
@@ -277,4 +297,4 @@ Options:
277297
278298
-h, --help
279299
Print help (see a summary with '-h')
280-
```
300+
```

pages/runtime/features.mdx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Each of this backends support different features, and have different support for
3131
### Wasmer features
3232
- **Caching**: compiled WebAssembly modules can be reused so subsequent runs of a Wasm file will have very little start up time;
3333
- **Metering**: computation time and other resources can be monitored and limits set to control how the Wasm code runs. This is also known as "gas metering";
34+
- **Profiling**: generate profiling data for WebAssembly code to analyze performance using tools like Linux perf;
3435

3536
## Support of features by backend
3637

@@ -58,6 +59,7 @@ Wasmer features:
5859
| -------- | ---------- | --------- | ---- | -- | ----- | -------------- | ------- |
5960
| Caching ||||||||
6061
| Metering ||||||||
62+
| Profiling||||||||
6163

6264

6365
## Backend support by Operating System
@@ -76,10 +78,10 @@ Wasmer features:
7678

7779
| | x86_64 | arm64 | x86 | RISC-V 64-bit | RISC-V 32-bit |
7880
| -------------- | ------ | ----- | --- | ------------- | ------------- |
79-
| Cranelift ||||| |
81+
| Cranelift ||||| |
8082
| LLVM ||||||
81-
| Singlepass |||| | |
83+
| Singlepass |||| | |
8284
| V8 ||||||
8385
| Wasmi ||||||
84-
| JavascriptCore ||| |||
85-
| Browser ||||||
86+
| JavascriptCore ||| |||
87+
| Browser ||||||

0 commit comments

Comments
 (0)