1# Profiling WebAssembly
2
3One of WebAssembly's major goals is to be quite close to native code in terms of
4performance, so typically when executing Wasm you'll be quite interested in how
5well your Wasm module is performing! From time to time you might want to dive a
6bit deeper into the performance of your Wasm, and this is where profiling comes
7into the picture.
8
9For best results, ideally you'd use hardware performance counters for your
10timing measurements. However, that requires special support from your CPU and
11operating system. Because Wasmtime is a JIT, that also requires hooks from
12Wasmtime to your platform's native profiling tools.
13
14As a result, Wasmtime support for native profiling is limited to certain
15platforms. See the following sections of this book if you're using these
16platforms:
17
18- On Linux, we support [perf](./examples-profiling-perf.md).
19
20- For Intel's x86 CPUs on Linux or Windows, we support
21  [VTune](./examples-profiling-vtune.md).
22
23- For Linux and macOS, we support [samply](./examples-profiling-samply.md).
24
25- For everything else, see the [cross-platform
26  profiler](./examples-profiling-guest.md).
27
28The native profilers can measure time spent in WebAssembly guest code as well as
29time spent in the Wasmtime host and potentially even time spent in the kernel.
30This provides a comprehensive view of performance.
31
32The cross-platform-profiler can only measure time spent in WebAssembly guest
33code, and its timing measurements are not as precise as the native profilers.
34However, it works on every platform that Wasmtime supports.
35
36