Improve CON perf tracking's ability to determine actor names

git-svn-id: https://svn.eduke32.com/eduke32@6737 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-03-08 02:39:21 +00:00
parent a22394db8d
commit 6e7cc1878a
3 changed files with 12 additions and 8 deletions

View file

@ -3559,6 +3559,11 @@ DO_DEFSTATE:
} }
g_szCurrentBlockName[j] = 0; g_szCurrentBlockName[j] = 0;
j = hash_find(&h_labels, g_szCurrentBlockName);
if (j != -1)
labeltype[j] |= LABEL_ACTOR;
if (tw == CON_USERACTOR) if (tw == CON_USERACTOR)
{ {
j = *g_scriptPtr; j = *g_scriptPtr;
@ -3574,7 +3579,7 @@ DO_DEFSTATE:
} }
} }
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_ACTOR);
g_scriptPtr--; g_scriptPtr--;
if (EDUKE32_PREDICT_FALSE((unsigned)*g_scriptPtr >= MAXTILES)) if (EDUKE32_PREDICT_FALSE((unsigned)*g_scriptPtr >= MAXTILES))
@ -3680,7 +3685,7 @@ DO_DEFSTATE:
} }
g_szCurrentBlockName[j] = 0; g_szCurrentBlockName[j] = 0;
// g_labelsOnly = 1; // g_labelsOnly = 1;
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_EVENT);
g_labelsOnly = 0; g_labelsOnly = 0;
g_scriptPtr--; g_scriptPtr--;
j= *g_scriptPtr; // type of event j= *g_scriptPtr; // type of event
@ -6271,7 +6276,7 @@ static void C_AddDefinition(const char *lLabel,int32_t lValue,int32_t lType)
static void C_AddDefaultDefinitions(void) static void C_AddDefaultDefinitions(void)
{ {
for (int i=0; i<MAXEVENTS; i++) for (int i=0; i<MAXEVENTS; i++)
C_AddDefinition(EventNames[i], i, LABEL_DEFINE); C_AddDefinition(EventNames[i], i, LABEL_DEFINE|LABEL_EVENT);
#if 0 #if 0
for (int i=0; i<NUMGAMEFUNCTIONS; i++) for (int i=0; i<NUMGAMEFUNCTIONS; i++)

View file

@ -40,6 +40,7 @@ enum
LABEL_ACTION = 8, LABEL_ACTION = 8,
LABEL_AI = 16, LABEL_AI = 16,
LABEL_MOVE = 32, LABEL_MOVE = 32,
LABEL_EVENT = 64,
}; };
#define LABEL_HASPARM2 1 #define LABEL_HASPARM2 1

View file

@ -1437,9 +1437,7 @@ static int32_t osdcmd_printtimes(osdfuncparm_t const * const UNUSED(parm))
OSD_Printf("\n -- event times: [event]={ total calls, total time [ms], mean time/call [us] }\n"); OSD_Printf("\n -- event times: [event]={ total calls, total time [ms], mean time/call [us] }\n");
} }
for (; n<maxlen; n++) buf[n] = 0;
buf[n] = ' ';
buf[maxlen] = 0;
OSD_Printf(" [%-26s]={ %8d, %10.3f, %10.3f },\n", OSD_Printf(" [%-26s]={ %8d, %10.3f, %10.3f },\n",
buf, g_eventCalls[i], g_eventTotalMs[i], buf, g_eventCalls[i], g_eventTotalMs[i],
@ -1459,14 +1457,14 @@ static int32_t osdcmd_printtimes(osdfuncparm_t const * const UNUSED(parm))
for (int ii=0; ii<g_labelCnt; ii++) for (int ii=0; ii<g_labelCnt; ii++)
{ {
if (labelcode[ii] == i && labeltype[ii] == LABEL_DEFINE) if (labelcode[ii] == i && labeltype[ii] & LABEL_ACTOR)
{ {
Bstrcpy(buf, label+(ii<<6)); Bstrcpy(buf, label+(ii<<6));
break; break;
} }
} }
if (!buf[0]) Bsprintf(buf, "%5d", i); if (!buf[0]) Bsprintf(buf, "%d", i);
OSD_Printf(" [%-26s]={ %8d, %9.3f, %9.3f, %9.3f, %9.3f },\n", OSD_Printf(" [%-26s]={ %8d, %9.3f, %9.3f, %9.3f, %9.3f },\n",
buf, g_actorCalls[i], g_actorTotalMs[i], buf, g_actorCalls[i], g_actorTotalMs[i],