WASM Debugger: Dump timed messages to file
Part of RV-213
What
Adds support for extracting timed debug messages from the WASM debugger using a --timings-file <file> option.
Why
We want those timings to compare with the RISC-V sandbox which can also output timings in the same shape.
How
- Moves the creation of the
write_debughook outside of the main rep-loop- This allows us to open the timings file once and continuously write to it, instead of re-opening it and appending it within the loop
- This leads to better UX overall when it comes to recording the timings
- Creates a new module
Timing_bufferwhose main functionality is being fed messages and at appropriate times flushing a line to a channel including the right timing - Adds a command-line option
--timings-file
Manually Testing
# Apply patch to allow floats in WASM kernels
curl 'https://gitlab.com/-/project/3836952/uploads/3f0d7fa811001a6ba6642360e9350776/allow-floats.patch' | patch -p1
# Download Jstz prerequisites
curl 'https://gitlab.com/-/project/3836952/uploads/0f20c0c7af733edc7f49644c8f71f587/inbox.json' -o inbox.json
curl 'https://gitlab.com/-/project/3836952/uploads/23aaad3074bd844c8bb98b56e32a29fb/jstz.wasm' -o jstz.wasm
# Run kernel using debugger
(echo step inbox; echo step inbox; echo step inbox; echo stop) | dune exec -- src/bin_wasm_debugger/main_wasm_debugger.exe --kernel jstz.wasm --inputs inbox.json --rollup sr163Lv22CdE8QagCwf48PWDTquk6isQwv57 --timings-file jstz-wasm.log
# Build result analyzer
make -C src/riscv/jstz inbox-bench
# Analyze results
src/riscv/jstz/inbox-bench results --inbox-file inbox.json --log-file jstz-wasm.log
Tasks for the Author
-
Link all Linear issues related to this MR using magic words (e.g. part of, relates to, closes). -
Eliminate dead code and other spurious artefacts introduced in your changes. -
Document new public functions, methods and types. -
Make sure the documentation for updated functions, methods, and types is correct. -
Add tests for bugs that have been fixed. -
Put in reasonable effort to ensure that CI will pass. -
Write commit messages to reflect the changes they're about. -
Self-review your changes to ensure they are high-quality. -
Complete all of the above before assigning this MR to reviewers.
Edited by Ole Krüger