mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Mod profiling support
Config settings: profiling = true/false (gather statistics) detailed_profiling = true/false (break mod times to callbacks) Chat commands: save_mod_profile saves current statistics in debug.txt and shows on console (on default loglevel)
This commit is contained in:
parent
4caa00cc99
commit
c24e0753fc
7 changed files with 391 additions and 0 deletions
|
@ -13,6 +13,19 @@ function core.register_chatcommand(cmd, def)
|
|||
core.chatcommands[cmd] = def
|
||||
end
|
||||
|
||||
if core.setting_getbool("mod_profiling") then
|
||||
local tracefct = profiling_print_log
|
||||
profiling_print_log = nil
|
||||
core.register_chatcommand("save_mod_profile",
|
||||
{
|
||||
params = "",
|
||||
description = "save mod profiling data to logfile " ..
|
||||
"(depends on default loglevel)",
|
||||
func = tracefct,
|
||||
privs = { server=true }
|
||||
})
|
||||
end
|
||||
|
||||
core.register_on_chat_message(function(name, message)
|
||||
local cmd, param = string.match(message, "^/([^ ]+) *(.*)")
|
||||
if not param then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue