Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
return on_timer() result
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Jan 3, 2021
1 parent c3568b0 commit 11c97f8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion luac.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ for d = 0, 1 do
if def then
local old_on_timer = def.on_timer

-- intercept on_timer call to measure time usage
def.on_timer = function(...)
local t0 = minetest.get_us_time()
old_on_timer(...)
local result = old_on_timer(...)
local t1 = minetest.get_us_time()
local diff = t1 -t0

metric_time_max.setmax(diff)
metric_time.inc(diff)
metric_count.inc(1)
return result
end
end
end
Expand Down

0 comments on commit 11c97f8

Please sign in to comment.