Debug mode: more benchmark precision

This commit is contained in:
Jean-Patrick Guerrero 2022-01-05 02:12:51 +01:00
parent 11e19dd80a
commit 364534d154

View File

@ -1461,7 +1461,7 @@ local function get_debug_grid(data, fs, full_height)
end end
local function make_fs(player, data) local function make_fs(player, data)
local start = debug_mode and os.clock() or nil local start = debug_mode and core.get_us_time() or nil
local fs = setmetatable({}, { local fs = setmetatable({}, {
__call = function(t, ...) __call = function(t, ...)
@ -1502,7 +1502,7 @@ local function make_fs(player, data)
if debug_mode then if debug_mode then
get_debug_grid(data, fs, full_height) get_debug_grid(data, fs, full_height)
msg(data.player_name, fmt("make_fs(): %.2f ms", (os.clock() - start) * 1000)) msg(data.player_name, fmt("make_fs(): %.2f ms", (core.get_us_time() - start) / 1000))
msg(data.player_name, fmt("#fs elements: %u", #fs)) msg(data.player_name, fmt("#fs elements: %u", #fs))
end end