-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
425ccd6
commit 807ad48
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
local metric_time = monitoring.counter("registered_on_joinplayers_time", "time usage in microseconds" .. | ||
"for registered_on_joinplayers calls") | ||
local metric_time_max = monitoring.gauge( | ||
"registered_on_joinplayers_time_max", | ||
"max time usage in microseconds for registered_on_joinplayers calls", | ||
{ autoflush=true } | ||
) | ||
|
||
|
||
minetest.register_on_mods_loaded(function() | ||
for i, fn in ipairs(minetest.registered_on_joinplayers) do | ||
|
||
minetest.registered_on_joinplayers[i] = function(...) | ||
local t0 = minetest.get_us_time() | ||
fn(...) | ||
local t1 = minetest.get_us_time() | ||
|
||
local diff = t1 - t0 | ||
metric_time.inc(diff) | ||
metric_time_max.setmax(diff) | ||
end | ||
|
||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
local metric_time = monitoring.counter("registered_on_prejoinplayers_time", "time usage in microseconds" .. | ||
"for registered_on_prejoinplayers calls") | ||
local metric_time_max = monitoring.gauge( | ||
"registered_on_prejoinplayers_time_max", | ||
"max time usage in microseconds for registered_on_prejoinplayers calls", | ||
{ autoflush=true } | ||
) | ||
|
||
|
||
minetest.register_on_mods_loaded(function() | ||
for i, fn in ipairs(minetest.registered_on_prejoinplayers) do | ||
|
||
minetest.registered_on_prejoinplayers[i] = function(...) | ||
local t0 = minetest.get_us_time() | ||
fn(...) | ||
local t1 = minetest.get_us_time() | ||
|
||
local diff = t1 - t0 | ||
metric_time.inc(diff) | ||
metric_time_max.setmax(diff) | ||
end | ||
|
||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters