A new Sampling Profiler version 23.3.6 is available, this version adds support for dynamic code, such as for Just-In-Time compilation.
This allows declaring dynamic code blocks to the profiler, so they can be reported as something more meaningful than a bunch of question marks ‘???’.
In practice, there are two new commands you can pass with OutputDebugString.
- SAMPLING DECLARE <block_start_in_hex> <block_length_in_hex> <name_of_the_block>
- SAMPLING UNDECLARE <block_start_in_hex>
If you reallocate a block of dynamic code at the same start address, you should UNDECLARE and then DECLARE it anew with the new size. If you want to differentiate calls before/after the reallocation, you should also specify a different name.
For instance, if we look at the following command:
SAMPLING DECLARE 00FE0000 000001CE DilateKernel
it declares a dynamically compiled block starting at absolute address $00FE0000, with a length of $1CE (462 bytes) whose name is “DilateKernel”. It is expected that at some point there will be the following command when the JIT block is released
SAMPLING UNDECLARE 00FE0000
Commands that do not exactly match the syntax are ignored.