interpreters-comparison
interpreters-comparison copied to clipboard
Add guest instruction count statistics collection and display
Add a mechanism to count how many times each of simulated opcode got executed.
Requirements for a solution
- It should only be active when
INSTR_STAT
macro is defined. I.e., it should be conditionally built in. - It should maintain an array of counters to keep statistics for individual opcodes. After every instruction is simulated, the corresponding counter should be incremented by one.
- At the end of simulation, the results table should be produced. It should look like this:
Opcode Count
-------------------
Nop 1000
Halt 1
Push 1234
...
- It can be implemented in a generic manner to support all variants of interpreters
After the implementation is ready, it will be nice to compare performance of two builds - interpreter with stats enabled and disabled, to see the performance overhead such collection creates.
I take it.
Not done