WebAssembly has become an important execution platform for performance
critical Web applications. This thesis presents the design and implementation
of a profiler for WebAssembly programs running in web browsers. The profiler
is implemented as a Manifest V3 browser extension and is complemented by
a Docker component used for advanced symbolization. The developed system
supports two profiling techniques: statistical sampling through the Chrome
DevTools Protocol and instrumentation using the Binaryen library. Profiling
results are represented as call trees and flame graphs. The profiler also
implements a symbolization process, where function indices are first mapped
to names obtained from the WebAssembly name section, while DWARF
debugging information is used to recover source-level function names, source
files, and line numbers.
The system was evaluated using a synthetic benchmark containing recursive calls, frequently executed functions, and short-lived functions. The results
show that instrumentation records all function invocations and provides exact
call counts, but introduces overhead proportional to the number of instrumented calls. Sampling introduces substantially lower overhead and produces
a call structure comparable to that obtained with the profiler perf, but
cannot reliably capture short-lived or infrequently occurring events and does
not provide exact invocation counts. The developed profiler implements sampling, instrumentation, symbolization, flame graph visualization and profile
import and export for WebAssembly applications running in Chromium-based
browsers.
|