We noticed that in some scenarios “stat unit” and it’s “Draw” field doesn’t show correct results (e.g. “0.2ms” instead of “8ms”). Looking into the code it seems that when there is more than 1 item in WindowElementLists during iteration in FSlateRHIRenderer::DrawWindows_Private, - it could schedule DrawWindow_RenderThread more than 1 time per render frame. It causes wrong calculation of draw time as many variables are globals (like GRenderThreadIdle, GRenderThreadTime, etc), and LastTimestamp calculation logic assumes it is called one time per frame.
To fix that, the whole block of calculation of these metrics can be moved in EndFrameRenderThread. Alternatively, calculation logic can be adjusted considering DrawWindow_RenderThread can be called multiple times. Does it makes sense?