FrameStats¶
Type
FrameStats reports how long each part of the engine took in the last frame, in seconds, and how much memory Luau uses, in bytes. Profiler.Frame returns it.
Example
-- Client script: warn when a frame takes longer than 1/30 second.
function Update(dt: number)
local frame = Profiler.Frame()
if frame and frame.Interval > 0.033 then
local logic = math.round(frame.Sim * 1000)
local drawing = math.round(frame.Render * 1000)
warn(`slow frame: {logic} ms logic, {drawing} ms drawing`)
end
end
Interval¶
Interval is the time in seconds from the start of the previous frame to the start of this one, or 0 on the first frame.
Sim¶
Sim is the time in seconds spent on game logic: scripts, physics, and networking.
Script¶
Script is the time in seconds spent running Luau scripts. Profiler.Scripts gives the time per script.
Physics¶
Physics is the time in seconds spent on physics.
Network¶
Network is the time in seconds spent sending and receiving network messages.
Render¶
Render is the time in seconds the client took to prepare its last drawn frame. It is 0 on the server.
Heap¶
Heap is the size of the Luau heap in bytes. If it keeps rising, scripts are keeping references to data they are done with.
HeapGrowth¶
HeapGrowth is how fast the Luau heap grows, in bytes per second, smoothed over recent frames in which it grew.