fix pre and post thinkframe perfstats pages
This commit is contained in:
1 parent
a4e6b5d177
commit
1f6096e3ff
3 files changed
+29
-8
No files matched your search
@@ -107,7 +107,9 @@ void LUA_HookInt(INT32 integer, int hook);
|
||||
int LUA_HookPlayer(player_t *, int hook);
|
||||
int LUA_HookTiccmd(player_t *, ticcmd_t *, int hook);
|
||||
|
||||
void LUA_HookPreThinkFrame(void);
|
||||
void LUA_HookThinkFrame(void);
|
||||
void LUA_HookPostThinkFrame(void);
|
||||
int LUA_HookTouchSpecial(mobj_t *special, mobj_t *toucher);
|
||||
int LUA_HookShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage);
|
||||
int LUA_HookMobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage);
|
||||
|
||||
+25
-6
@@ -628,10 +628,8 @@ int LUA_HookTiccmd(player_t *player, ticcmd_t *cmd, int hook_type)
|
||||
SPECIALIZED HOOKS
|
||||
========================================================================= */
|
||||
|
||||
void LUA_HookThinkFrame(void)
|
||||
static void hook_think_frame(int type)
|
||||
{
|
||||
const int type = HOOK(ThinkFrame);
|
||||
|
||||
// variables used by perf stats
|
||||
int hook_index = 0;
|
||||
precise_t time_taken = 0;
|
||||
@@ -649,7 +647,7 @@ void LUA_HookThinkFrame(void)
|
||||
{
|
||||
get_hook(&hook, map->ids, k);
|
||||
|
||||
if (cv_perfstats.value == 3)
|
||||
if (cv_perfstats.value >= 3)
|
||||
{
|
||||
lua_pushvalue(gL, -1);/* need the function again */
|
||||
time_taken = I_GetPreciseTime();
|
||||
@@ -657,12 +655,18 @@ void LUA_HookThinkFrame(void)
|
||||
|
||||
call_single_hook(&hook);
|
||||
|
||||
if (cv_perfstats.value == 3)
|
||||
if (cv_perfstats.value >= 3)
|
||||
{
|
||||
lua_Debug ar;
|
||||
time_taken = I_GetPreciseTime() - time_taken;
|
||||
lua_getinfo(gL, ">S", &ar);
|
||||
PS_SetThinkFrameHookInfo(hook_index, time_taken, ar.short_src);
|
||||
if (type == 4) // sorry for magic numbers
|
||||
PS_SetPreThinkFrameHookInfo(hook_index, time_taken, ar.short_src);
|
||||
else if (type == 5)
|
||||
PS_SetThinkFrameHookInfo(hook_index, time_taken, ar.short_src);
|
||||
else if (type == 6)
|
||||
PS_SetPostThinkFrameHookInfo(hook_index, time_taken, ar.short_src);
|
||||
|
||||
hook_index++;
|
||||
}
|
||||
}
|
||||
@@ -671,6 +675,21 @@ void LUA_HookThinkFrame(void)
|
||||
}
|
||||
}
|
||||
|
||||
void LUA_HookPreThinkFrame(void)
|
||||
{
|
||||
hook_think_frame(HOOK(PreThinkFrame));
|
||||
}
|
||||
|
||||
void LUA_HookThinkFrame(void)
|
||||
{
|
||||
hook_think_frame(HOOK(ThinkFrame));
|
||||
}
|
||||
|
||||
void LUA_HookPostThinkFrame(void)
|
||||
{
|
||||
hook_think_frame(HOOK(PostThinkFrame));
|
||||
}
|
||||
|
||||
int LUA_HookTouchSpecial(mobj_t *special, mobj_t *toucher)
|
||||
{
|
||||
Hook_State hook;
|
||||
|
||||
+2
-2
@@ -528,7 +528,7 @@ void P_Ticker(boolean run)
|
||||
ps_checkposition_calls.value.i = 0;
|
||||
|
||||
PS_START_TIMING(ps_lua_prethinkframe_time);
|
||||
LUA_HOOK(PreThinkFrame);
|
||||
LUA_HookPreThinkFrame();
|
||||
PS_STOP_TIMING(ps_lua_prethinkframe_time);
|
||||
|
||||
PS_START_TIMING(ps_playerthink_time);
|
||||
@@ -668,7 +668,7 @@ void P_Ticker(boolean run)
|
||||
D_MapChange(gamemap, gametype, encoremode, true, 0, false, false);
|
||||
|
||||
PS_START_TIMING(ps_lua_postthinkframe_time);
|
||||
LUA_HOOK(PostThinkFrame);
|
||||
LUA_HookPostThinkFrame();
|
||||
PS_STOP_TIMING(ps_lua_postthinkframe_time);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user