ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. getServerPerformance

Function

getServerPerformance

ServerUtilitiesTrilogy Hub only

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