Skip to content

ProcessCPUUsage field values doesn't mean anythingΒ #1

@FlorianLeChat

Description

@FlorianLeChat

Recently, I switched from the old version of this module to the new one and I noticed that the ProcessCPUUsage field was giving completely ununderstandable values and didn't seem to make sense compared to the others.

For example, here is the result I can get (it happens to me all the time and is not exceptional):

> PrintTable(serverstat.All())...
LogicalCPUs = 8
PhysicalCPUs = 8
ProcessCPUUsage = 40300 -- ???
ProcessMemoryUsage = 572.24609375
SystemAvailableMemory = 19969.983398438
SystemCPUUsage = 41.920177459717
SystemMemoryUsage = 49319.202148438
SystemTotalMemory = 70362.319335938

The same thing happens with the asynchronous function (but sometimes it returns 0 without any reason).

> serverstat.async.All(function(data) PrintTable(data) end)...
LogicalCPUs = 8
PhysicalCPUs = 8
ProcessCPUUsage = 0 -- ???
ProcessMemoryUsage = 573.2109375
SystemAvailableMemory = 20000.5234375
SystemCPUUsage = 100 -- Why not
SystemMemoryUsage = 49288.662109375
SystemTotalMemory = 70362.319335938

For information, my server is on a dedicated machine hosted by a game provider (so I don't have control of the machine to check the stats). AFAIK, the server is running under Debian 10 64-bit.

] version
Protocol version 24
Exe version 2021.06.09 (garrysmod)
Exe build: 14:56:57 Jul 12 2021 (8283) (4000)
GMod version 2021.07.12, branch: unknown
Linux 32bit Dedicated Server

And here is the script I use to get the information from the module.

-- From : https://github.com/WilliamVenner/gmsv_serverstat/
if not file.Exists("bin/gmsv_serverstat_*.dll", "LUA") then return end

require("serverstat")

concommand.Add("server-stats", function(ply)

    local data = serverstat.All()
    local phrase = "CPU Usage : %s (%s/%s)\nMemory Usage : %s (%s)"

    phrase = string.format(phrase,

        math.Round(data.ProcessCPUUsage, 2) .. "%",

        data.LogicalCPUs, data.PhysicalCPUs,

        string.NiceSize(data.ProcessMemoryUsage * 10 ^ 6),

        string.NiceSize(data.SystemTotalMemory * 10 ^ 6)

    )

    Raven.Server.SendChatMessage(ply, color_red, phrase)

end)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions