diff options
author | sapier <Sapier at GMX dot net> | 2014-08-12 23:07:27 +0200 |
---|---|---|
committer | sapier <Sapier at GMX dot net> | 2014-08-19 22:22:57 +0200 |
commit | c24e0753fc240636b2f9b1889554649e67c9046c (patch) | |
tree | 1de1583525dbce908a470941745e3a6b0c23b3c2 /src/script/lua_api | |
parent | 4caa00cc99af133e5724cd8ab04f5cb8db81a666 (diff) | |
download | minetest-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 'src/script/lua_api')
-rw-r--r-- | src/script/lua_api/l_env.cpp | 8 | ||||
-rw-r--r-- | src/script/lua_api/l_env.h | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 42bfc4beb..e6ca846d8 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -797,6 +797,13 @@ int ModApiEnvMod::l_forceload_free_block(lua_State *L) return 0; } +// get_us_time() +int ModApiEnvMod::l_get_us_time(lua_State *L) +{ + lua_pushnumber(L, porting::getTimeUs()); + return 1; +} + void ModApiEnvMod::Initialize(lua_State *L, int top) { API_FCT(set_node); @@ -834,4 +841,5 @@ void ModApiEnvMod::Initialize(lua_State *L, int top) API_FCT(transforming_liquid_add); API_FCT(forceload_block); API_FCT(forceload_free_block); + API_FCT(get_us_time); } diff --git a/src/script/lua_api/l_env.h b/src/script/lua_api/l_env.h index 420866d5d..76c6594ab 100644 --- a/src/script/lua_api/l_env.h +++ b/src/script/lua_api/l_env.h @@ -156,6 +156,9 @@ private: // stops forceloading a position static int l_forceload_free_block(lua_State *L); + // get us precision time + static int l_get_us_time(lua_State *L); + public: static void Initialize(lua_State *L, int top); }; |