WASM/Debugger: profile time
Context
Profile now also returns the time spent in each phases (and internally for each function).
This subsumes the bench
function that was removed recently.
Fixes #5615 (closed)
Manually testing the MR
Run the debugger on your favorite kernel (or with the EVM kernel and this input inputs_1_test.json)
dune exec src/bin_wasm_debugger/main_wasm_debugger.exe -- src/kernel_evm/target/wasm32-unknown-unknown/release/evm_kernel.wasm --inputs inputs_1_test.json
> profile
Starting the profiling until new messages are expected. Please note that it will take some time and does not reflect a real computation time.
Profiling result can be found in /tmp/wasm-debugger-profiling-2023-06-29T16:31:41.061-00:00.out
----------------------
The full execution took 11000000000 ticks (including padding).
----------------------
Detailed results:
%interpreter(decode): 1590001 ticks (10.846s)
%interpreter(link): 14 ticks (32.965us)
%interpreter(init): 45306921 ticks (1min47s)
kernel_run: 29172235 ticks (1min12s)
Loaded 1 inputs at level 0
Storing block 0000000000000000000000000000000000000000000000000000000000000000 at number 0 containing 3 transaction(s).
Genesis block was initialized.
Blueprint 0 contains 1 transactions.
Stage two
Reading block 0000000000000000000000000000000000000000000000000000000000000000 at number 0 containing 3 transaction(s).
Going to run an Ethereum transaction - from address: 0x6ce4…6e1c - to address: Some(0xb53dc01974176e5dff2298c5a94343c2585e3c54)Begin initial transaction at transaction depth: 0Executing a transferThe initial transaction ended with success: ReturnedCommitting initial transaction. Level is 1Storing block 0000000000000000000000000000000000000000000000000000000000000001 at number 1 containing 1 transaction(s).
...
You can also use the time
command wrapper in the debugger to convince yourself that the profiled time is indeed correct.
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rst
for the protocol and the environment,CHANGES.rst
at the root of the repository for everything else). -
Select suitable reviewers using the Reviewers
field below. -
Select as Assignee
the next person who should take action on that MR