- Documentation
- Server functions
- getServerPerformance
Function
getServerPerformance
Returns 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.
Syntax
table getServerPerformance()Returns
{ cpu, loopMeanMs, loopMaxMs, ramMB, heapMB, luaKB, players, seconds } (cpu = % of one core), or false.
Example
setTimer(function()
local p = getServerPerformance()
if p and p.loopMaxMs > 100 then
outputServerLog(("Petla serwera stanela na %d ms"):format(p.loopMaxMs))
end
end, 10000, 0)
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.getGamePerformanceReturns 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 bygetResourceUsage.getPerformanceStatsReturns server statistics as columns and rows. Without a category: uptime, players, vehicles, objects, timers, resources and the number of API functions. The"Lua timing"category gives the script time of each resource (CPU, calls per second, longest call, allocated memory); the filter narrows it to resources whose name contains that text.