Files
BeamMP-Server/include
Lion 1794c3fe45 Add Lua execution profiler Util.DebugExecutionTime() (#267)
Adds `Util.DebugExecutionTime()`, which returns a table of
`function_name: milliseconds`, in which each function's execution time
is averaged over all time.

You can call this function like so:
```lua
-- event to print the debug times
MP.RegisterEvent("printStuff", "printStuff")
-- prints the execution time of all event handlers
function printStuff()
	print(Util.DebugExecutionTime())
end
-- run every 5 seconds (or 10, or 60, whatever makes sense for you
MP.CreateEventTimer("printStuff", 5000)
```

Pretty print function:
```lua
function printDebugExecutionTime()
    local stats = Util.DebugExecutionTime()
    local pretty = "DebugExecutionTime:\n"
    local longest = 0
    for name, t in pairs(stats) do
        if #name > longest then
            longest = #name
        end
    end
    for name, t in pairs(stats) do
        pretty = pretty .. string.format("%" .. longest + 1 .. "s: %12f +/- %12f (min: %12f, max: %12f) (called %d time(s))\n", name, t.mean, t.stdev, t.min, t.max, t.n)
    end
    print(pretty)
end
```

`Util.DebugExecutionTime()` returns a table, where each key is an event
handler function name, and each value is a table consisting of `mean`
(simple average), `stddev` (standard deviation aka mean of the
variance), `min` and `max`, all in milliseconds, as well as `n` as the
number of samples taken.
2024-05-08 11:46:02 +02:00
..
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-05-06 14:37:34 +02:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-03-07 01:03:16 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-05-06 11:56:26 +02:00
2024-02-07 16:07:22 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-02-08 23:29:10 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00
2024-01-23 21:00:11 +01:00