- Documentation
- Client functions
- getGamePerformance
Function
getGamePerformance
Returns the game's performance for this player since the previous read (a window of at least 250 ms): FPS, average and longest frame time, script time per frame, the game's CPU and memory use, and ping. Which resource costs the most is shown by getResourceUsage.
Syntax
table getGamePerformance()Returns
{ fps, frameMs, frameMaxMs, luaMs, luaMaxMs, cpu, cores, ramMB, privateMB, luaKB, ping } (cpu = % of the whole CPU), or false.
Example
addCommandHandler("fps", function()
local p = getGamePerformance()
if p then outputChatBox(("FPS %d, klatka %.1f ms, RAM %d MB"):format(p.fps, p.frameMs, p.ramMB)) end
end)
See also
getResourceUsageShows how much CPU time and memory the scripts of each resource use: event handlers, timers, commands and exports. It measures since the previous read (the shortest window is 1 s, a more frequent read gets the previous result). On the server it covers server resources; on the client it covers the resources running for the player and also gives the time per rendered frame. The/statspanel of the defaultstatsresource works this way.getServerPerformanceReturns the server load since the previous read (a window of at least 250 ms): CPU, server loop delay, memory and player count. A large loop delay (loopMaxMs) is what players see as stuttering characters and cars.