summaryrefslogtreecommitdiff
path: root/builtin/game/chatcommands.lua
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2014-08-12 23:07:27 +0200
committersapier <Sapier at GMX dot net>2014-08-19 22:22:57 +0200
commitc24e0753fc240636b2f9b1889554649e67c9046c (patch)
tree1de1583525dbce908a470941745e3a6b0c23b3c2 /builtin/game/chatcommands.lua
parent4caa00cc99af133e5724cd8ab04f5cb8db81a666 (diff)
downloadminetest-c24e0753fc240636b2f9b1889554649e67c9046c.tar.gz
minetest-c24e0753fc240636b2f9b1889554649e67c9046c.tar.bz2
minetest-c24e0753fc240636b2f9b1889554649e67c9046c.zip
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)
Diffstat (limited to 'builtin/game/chatcommands.lua')
-rw-r--r--builtin/game/chatcommands.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua
index 39425f0eb..9293e98f4 100644
--- a/builtin/game/chatcommands.lua
+++ b/builtin/game/chatcommands.lua
@@ -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