How would I get the true frame time even if there is a fps cap

To be more specific, frames get into a sleeping mode after it has finished all the work for that frame. This sleep lasts until the total frame time is reached (60fps = 0.016s of total frame time), what I’m asking for is if I can get a frame’s time without the sleep.

Here is a very badly written image of a frame:


Note: Rendering is the last step of a frame and the rest of the steps cannot be seen on this photo

If you have any questions, or you don’t understand something, don’t be afraid to ask!


local latestDt = 0
RunService. RenderStepped: Connect (function (d'
latestDt = dt
end)
RunService. PreRender:Connect (function ()
local now = tick()
local workTime = now - lastPreRender
lastPreRender = now
print(string.format(
"[Work] %0.4f s | [RenderStepped dt workTime, latestDt, latestDt - work
end)

I appreciate the response! Even though it took a lot of time to decipher the code, I did run it and it only gives the capped frame time. I understand the question might be confusing, but to be even MORE specific, I’m asking if there is a very unknown method that gets you the true frame time, if there is another way though, that would be great!

I doubt there’s anything you can do to get the true time through scripts, but if someone does know one I’ll be pleasantly surprised.

Currently the only way I know of to get the true frame-time is through the micro-profiler’s debug window, as it will display how long it took for the engine to complete each process on any given frame, as seen in this image:


Unfortunately, this isn’t practical, as it requires both knowledge of this debug window and manually identifying the time via the measurements shown at the top of the window before the graph we’re so familiar with.