Commit 92ea05b3 authored by Richard Gobeille's avatar Richard Gobeille

Duke3d: remove "printtimes" console command

This information is pretty much useless compared to using the profiler.
parent 0ef58149
......@@ -6302,9 +6302,6 @@ void C_Compile(const char *fileName)
for (auto & i : g_tile)
Bmemset(&i, 0, sizeof(tiledata_t));
for (double & actorMinMs : g_actorMinMs)
actorMinMs = 1e308;
scriptInitTables();
VM_InitHashTables();
......
......@@ -71,10 +71,6 @@ int32_t g_textureVarID = -1; // var ID of "TEXTURE"
int32_t g_thisActorVarID = -1; // var ID of "THISACTOR"
int32_t g_structVarIDs = -1;
// for timing events and actors
uint32_t g_eventCalls[MAXEVENTS], g_actorCalls[MAXTILES];
double g_eventTotalMs[MAXEVENTS], g_actorTotalMs[MAXTILES], g_actorMinMs[MAXTILES], g_actorMaxMs[MAXTILES];
GAMEEXEC_STATIC void VM_Execute(int const loop = false);
void VM_ScriptInfo(intptr_t const * const ptr, int const range)
......@@ -163,8 +159,6 @@ static FORCE_INLINE int32_t VM_EventInlineInternal__(int const eventNum, int con
insptr = apScript + apScriptEvents[eventNum];
globalReturn = returnValue;
auto const t = timerGetPerformanceCounter();
if ((unsigned)spriteNum >= MAXSPRITES)
VM_DummySprite();
......@@ -176,9 +170,6 @@ static FORCE_INLINE int32_t VM_EventInlineInternal__(int const eventNum, int con
if (vm.flags & VM_KILL)
VM_DeleteSprite(vm.spriteNum, vm.playerNum);
g_eventTotalMs[eventNum] += (double)(1000*(timerGetPerformanceCounter()-t))/timerGetPerformanceFrequency();
g_eventCalls[eventNum]++;
// restoring these needs to happen after VM_DeleteSprite() due to event recursion
returnValue = globalReturn;
......@@ -6400,20 +6391,11 @@ void A_Execute(int const spriteNum, int const playerNum, int const playerDist)
}
VM_UpdateAnim(vm.spriteNum, vm.pData);
int const picnum = vm.pSprite->picnum;
auto t = timerGetPerformanceCounter();
insptr = 4 + (g_tile[vm.pSprite->picnum].execPtr);
VM_Execute(true);
insptr = NULL;
auto ms = (double)(1000*(timerGetPerformanceCounter()-t))/timerGetPerformanceFrequency();
g_actorTotalMs[picnum] += ms;
g_actorMinMs[picnum] = min(g_actorMinMs[picnum], ms);
g_actorMaxMs[picnum] = max(g_actorMaxMs[picnum], ms);
g_actorCalls[picnum]++;
if ((vm.flags & VM_KILL) == 0)
{
VM_Move();
......
......@@ -77,9 +77,6 @@ extern int32_t g_currentEvent;
void A_LoadActor(int const spriteNum);
extern uint32_t g_eventCalls[MAXEVENTS], g_actorCalls[MAXTILES];
extern double g_eventTotalMs[MAXEVENTS], g_actorTotalMs[MAXTILES], g_actorMinMs[MAXTILES], g_actorMaxMs[MAXTILES];
void A_Execute(int spriteNum, int playerNum, int playerDist);
void A_Fall(int spriteNum);
int A_GetFurthestAngle(int const spriteNum, int const angDiv);
......
......@@ -1328,73 +1328,6 @@ static int osdcmd_purgesaves(osdcmdptr_t UNUSED(parm))
return OSDCMD_OK;
}
static int osdcmd_printtimes(osdcmdptr_t UNUSED(parm))
{
UNREFERENCED_CONST_PARAMETER(parm);
char buf[32];
int32_t maxlen = 0;
int32_t haveev=0, haveac=0;
static char const s_event_[] = "EVENT_";
int constexpr strlen_event_ = ARRAY_SIZE(s_event_) - 1;
for (auto & EventName : EventNames)
{
int const len = Bstrlen(EventName+strlen_event_);
Bassert(len < ARRAY_SSIZE(buf));
maxlen = max(len, maxlen);
}
for (int i=0; i<MAXEVENTS; i++)
if (g_eventCalls[i])
{
int32_t n=Bsprintf(buf, "%s", EventNames[i]+strlen_event_);
if (!haveev)
{
haveev = 1;
OSD_Printf("\nevent times: event, total calls, total time [ms], mean time/call [us]\n");
}
buf[n] = 0;
OSD_Printf("%17s, %8d, %10.3f, %10.3f,\n",
buf, g_eventCalls[i], g_eventTotalMs[i],
1000*g_eventTotalMs[i]/g_eventCalls[i]);
}
for (int i=0; i<MAXTILES; i++)
if (g_actorCalls[i])
{
if (!haveac)
{
haveac = 1;
OSD_Printf("\nactor times: tile, total calls, total time [ms], {min,mean,max} time/call [us]\n");
}
buf[0] = 0;
for (int ii=0; ii<g_labelCnt; ii++)
{
if (labelcode[ii] == i && labeltype[ii] & LABEL_ACTOR)
{
Bstrcpy(buf, label+(ii<<6));
break;
}
}
if (!buf[0]) Bsprintf(buf, "%d", i);
OSD_Printf("%17s, %8d, %9.3f, %9.3f, %9.3f, %9.3f,\n",
buf, g_actorCalls[i], g_actorTotalMs[i],
1000*g_actorMinMs[i],
1000*g_actorTotalMs[i]/g_actorCalls[i],
1000*g_actorMaxMs[i]);
}
return OSDCMD_OK;
}
static int osdcmd_cvar_set_game(osdcmdptr_t parm)
{
int const r = osdcmd_cvar_set(parm);
......@@ -1761,9 +1694,6 @@ int32_t registerosdcommands(void)
OSD_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);
OSD_RegisterFunction("printtimes", "printtimes: prints VM timing statistics", osdcmd_printtimes);
OSD_RegisterFunction("purgesaves", "purgesaves: deletes obsolete and unreadable save files", osdcmd_purgesaves);
OSD_RegisterFunction("quicksave","quicksave: performs a quick save", osdcmd_quicksave);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment