mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Lunatic: also save min, max actor times; fix release build.
git-svn-id: https://svn.eduke32.com/eduke32@3557 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6b1df7f1e9
commit
3b3bc6bc01
5 changed files with 29 additions and 13 deletions
|
@ -1182,6 +1182,8 @@ static int32_t G_GetMorale(int32_t p_i, int32_t snum)
|
|||
#if !defined LUNATIC
|
||||
return Gv_GetVarByLabel("PLR_MORALE",-1, p_i, snum);
|
||||
#else
|
||||
UNREFERENCED_PARAMETER(p_i);
|
||||
UNREFERENCED_PARAMETER(snum);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -5172,7 +5172,6 @@ void A_LoadActor(int32_t iActor)
|
|||
void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
|
||||
{
|
||||
#ifdef LUNATIC
|
||||
double t;
|
||||
int32_t killit=0;
|
||||
#endif
|
||||
vmstate_t tempvm = { iActor, iPlayer, lDist, &actor[iActor].t_data[0],
|
||||
|
@ -5235,13 +5234,19 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
|
|||
}
|
||||
|
||||
#ifdef LUNATIC
|
||||
t = gethitickms();
|
||||
{
|
||||
double t = gethitickms();
|
||||
const int32_t picnum = vm.g_sp->picnum;
|
||||
|
||||
if (L_IsInitialized(&g_ElState) && El_HaveActor(vm.g_sp->picnum))
|
||||
killit = (El_CallActor(&g_ElState, vm.g_sp->picnum, iActor, iPlayer, lDist)==1);
|
||||
if (L_IsInitialized(&g_ElState) && El_HaveActor(picnum))
|
||||
killit = (El_CallActor(&g_ElState, picnum, iActor, iPlayer, lDist)==1);
|
||||
|
||||
g_actorTotalMs[vm.g_sp->picnum] += gethitickms()-t;
|
||||
g_actorCalls[vm.g_sp->picnum]++;
|
||||
t = gethitickms()-t;
|
||||
g_actorTotalMs[picnum] += t;
|
||||
g_actorMinMs[picnum] = min(g_actorMinMs[picnum], t);
|
||||
g_actorMaxMs[picnum] = max(g_actorMaxMs[picnum], t);
|
||||
g_actorCalls[picnum]++;
|
||||
}
|
||||
#else
|
||||
insptr = 4 + (g_tile[vm.g_sp->picnum].execPtr);
|
||||
VM_Execute(1);
|
||||
|
|
|
@ -72,6 +72,7 @@ s_buildRev;
|
|||
g_sizes_of_what;
|
||||
g_sizes_of;
|
||||
g_elCallDepth;
|
||||
g_elEventRETURN;
|
||||
g_modDir;
|
||||
|
||||
kopen4loadfrommod;
|
||||
|
@ -131,6 +132,7 @@ luaJIT_BC_bcarray;
|
|||
luaJIT_BC_bcheck;
|
||||
luaJIT_BC_xmath;
|
||||
luaJIT_BC_defs;
|
||||
luaJIT_BC_v;
|
||||
|
||||
rand_jkiss_u32;
|
||||
rand_jkiss_dbl;
|
||||
|
|
|
@ -28,7 +28,7 @@ int32_t g_elEventRETURN;
|
|||
|
||||
// for timing events and actors
|
||||
uint32_t g_eventCalls[MAXEVENTS], g_actorCalls[MAXTILES];
|
||||
double g_eventTotalMs[MAXEVENTS], g_actorTotalMs[MAXTILES];
|
||||
double g_eventTotalMs[MAXEVENTS], g_actorTotalMs[MAXTILES], g_actorMinMs[MAXTILES], g_actorMaxMs[MAXTILES];
|
||||
|
||||
// Used as Lua registry key to the tweak_traceback_msg() function, set to 1 if
|
||||
// such a function has been registered.
|
||||
|
@ -100,12 +100,14 @@ void El_PrintTimes(void)
|
|||
}
|
||||
|
||||
OSD_Printf(" },\n\n {\n");
|
||||
OSD_Printf(" -- actor times, [tile]={ total calls, total time [ms], mean time/call [us] }\n");
|
||||
OSD_Printf(" -- actor times, [tile]={ total calls, total time [ms], {min,mean,max} time/call [us] }\n");
|
||||
for (i=0; i<MAXTILES; i++)
|
||||
if (g_actorCalls[i])
|
||||
OSD_Printf(" [%5d]={ %8d, %9.3f, %9.3f },\n",
|
||||
OSD_Printf(" [%5d]={ %8d, %9.3f, %9.3f, %9.3f, %9.3f },\n",
|
||||
i, g_actorCalls[i], g_actorTotalMs[i],
|
||||
1000*g_actorTotalMs[i]/g_actorCalls[i]);
|
||||
1000*g_actorMinMs[i],
|
||||
1000*g_actorTotalMs[i]/g_actorCalls[i],
|
||||
1000*g_actorMaxMs[i]);
|
||||
OSD_Printf(" },\n}\n");
|
||||
}
|
||||
|
||||
|
@ -372,6 +374,11 @@ static void El_StateSetup(lua_State *L)
|
|||
// 0: success, <0: failure
|
||||
int32_t El_CreateState(L_State *estate, const char *name)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
for (i=0; i<MAXTILES; i++)
|
||||
g_actorMinMs[i] = 1e308;
|
||||
|
||||
L_ErrorFunc = El_OnError;
|
||||
L_OutOfMemFunc = El_OnOutOfMem;
|
||||
|
||||
|
@ -440,9 +447,9 @@ static int32_t call_regd_function3(lua_State *L, void *keyaddr,
|
|||
int32_t iActor, int32_t iPlayer, int32_t lDist)
|
||||
{
|
||||
int32_t i, haveerr;
|
||||
|
||||
#if !defined NDEBUG
|
||||
int32_t top = lua_gettop(L);
|
||||
|
||||
#endif
|
||||
lua_pushcfunction(L, &our_traceback_CF);
|
||||
|
||||
// get the Lua function from the registry
|
||||
|
|
|
@ -23,7 +23,7 @@ extern uint8_t g_elEvents[MAXEVENTS]; // shouldn't be used directly
|
|||
extern el_actor_t g_elActors[MAXTILES];
|
||||
|
||||
extern uint32_t g_eventCalls[MAXEVENTS], g_actorCalls[MAXTILES];
|
||||
extern double g_eventTotalMs[MAXEVENTS], g_actorTotalMs[MAXTILES];
|
||||
extern double g_eventTotalMs[MAXEVENTS], g_actorTotalMs[MAXTILES], g_actorMinMs[MAXTILES], g_actorMaxMs[MAXTILES];
|
||||
|
||||
// -- functions --
|
||||
void El_PrintTimes(void);
|
||||
|
|
Loading…
Reference in a new issue