sorted profile table

extensions
Steven Massey 4 years ago
parent f209be8663
commit a0c42219f8

@ -184,6 +184,8 @@ void m3_FreeRuntime (IM3Runtime i_runtime)
{
if (i_runtime)
{
m3_PrintProfilerInfo ();
ReleaseRuntime (i_runtime);
m3Free (i_runtime);
}

@ -440,7 +440,7 @@ d_m3OpDef (DumpStack)
# if d_m3EnableOpProfiling
//--------------------------------------------------------------------------------------------------------
M3ProfilerSlot s_opProfilerCounts [c_m3ProfilerSlotMask] = {};
M3ProfilerSlot s_opProfilerCounts [c_m3ProfilerSlotMask + 1] = {};
void ProfileHit (cstr_t i_operationName)
{
@ -460,15 +460,34 @@ void ProfileHit (cstr_t i_operationName)
slot->hitCount++;
}
void m3_PrintProfilerInfo ()
{
M3ProfilerSlot dummy;
M3ProfilerSlot * maxSlot = & dummy;
do
{
maxSlot->hitCount = 0;
for (u32 i = 0; i <= c_m3ProfilerSlotMask; ++i)
{
M3ProfilerSlot * slot = & s_opProfilerCounts [i];
if (slot->opName)
printf ("%13llu %s\n", slot->hitCount, slot->opName);
{
if (slot->hitCount > maxSlot->hitCount)
maxSlot = slot;
}
}
if (maxSlot->opName)
{
fprintf (stderr, "%13llu %s\n", maxSlot->hitCount, maxSlot->opName);
maxSlot->opName = NULL;
}
}
while (maxSlot->hitCount);
}
# else

Loading…
Cancel
Save