Measuring WASM execution time

There is a functionality today which is very useful.

Debug → Display WASM Debug Window
Then select target.wasm from the Modules list
Then select my_gauge from the Gauges list.

Now you can see Execution Time next to each of the panel service callbacks.

This was insanely useful and I was able to tune my WASM from 3000us down to 200us. This was by far the single most useful tool for WASM performance tuning for us. It is much appreciated to have this and it already made the difference.

The thing is, we can’t find a way to measure execution time on any other callback, like a visual frame callback or any entry point which isn’t through a gauge panel service callback.

Question: Is there any other way to measure with a microsecond-precise timestamp?

The STL clock functions available in WASM may suggest a lower interval is possible, but in practice there is only the ability to determine if you have executed for >1ms +/-1ms. When WASM time takes 1ms per frame it is already too slow, so this doesn’t really help with tuning.