Refactor SWWMHandler profiling routines.

This commit is contained in:
Mari the Deer 2022-02-25 16:51:20 +01:00
commit f6b891c9fe
7 changed files with 104 additions and 74 deletions

View file

@ -13,7 +13,7 @@ extend Class SWWMHandler
override void WorldThingRevived( WorldEvent e )
{
if ( profiling ) curms = MSTime();
if ( profiling ) ProfileTick();
// reattach combat tracker
if ( !swwm_notrack && (e.Thing.bSHOOTABLE || e.Thing.bISMONSTER) && !(e.Thing is 'LampMoth') && !(e.Thing is 'CompanionLamp') )
SWWMCombatTracker.Spawn(e.Thing);
@ -27,7 +27,7 @@ extend Class SWWMHandler
}
if ( !(e.Thing is 'PlayerPawn') )
{
if ( profiling ) worldthingrevived_ms += MSTime()-curms;
if ( profiling ) ProfileTock(PT_WORLDTHINGREVIVED);
return;
}
// reset some vars
@ -41,7 +41,7 @@ extend Class SWWMHandler
// reset uptime since player had just died
SWWMStats s = SWWMStats.Find(e.Thing.player);
if ( s ) s.lastspawn = level.totaltime;
if ( profiling ) worldthingrevived_ms += MSTime()-curms;
if ( profiling ) ProfileTock(PT_WORLDTHINGREVIVED);
}
private bool HexenMap40()
@ -76,7 +76,7 @@ extend Class SWWMHandler
override void WorldThingDied( WorldEvent e )
{
if ( profiling ) curms = MSTime();
if ( profiling ) ProfileTick();
if ( e.Thing.default.bISMONSTER && ((e.Thing.default.bBOSS) || (e.Thing.GetSpawnHealth() >= 1000) || e.Thing.FindInventory("BossMarker")) && (alreadygold.Find(e.Thing) == alreadygold.Size()) )
{
// make sure we can't farm drops from revivable enemies
@ -142,7 +142,7 @@ extend Class SWWMHandler
bool gotgibbed = (!e.Thing.bDONTGIB && ((e.Inflictor && e.Inflictor.bEXTREMEDEATH) || (e.DamageSource && e.DamageSource.bEXTREMEDEATH) || (e.DamageType == 'Extreme') || (e.Thing.Health < gibhealth)) && (!e.Inflictor || !e.Inflictor.bNOEXTREMEDEATH) && (!e.DamageSource || !e.DamageSource.bNOEXTREMEDEATH));
if ( !gotgibbed )
{
if ( profiling ) worldthingdied_ms += MSTime()-curms;
if ( profiling ) ProfileTock(PT_WORLDTHINGDIED);
return;
}
if ( (e.Thing.GetClass() == "Demon") || (e.Thing.GetClass() == "Spectre") )
@ -161,7 +161,7 @@ extend Class SWWMHandler
ExtraGibDeaths.GibThis(e.Thing,"ArachXDeath");
else if ( e.Thing.GetClass() == "Fatso" )
ExtraGibDeaths.GibThis(e.Thing,"FatsoXDeath");
if ( profiling ) worldthingdied_ms += MSTime()-curms;
if ( profiling ) ProfileTock(PT_WORLDTHINGDIED);
}
private void DoKeyTagFix( Actor a )
@ -228,13 +228,13 @@ extend Class SWWMHandler
override void WorldThingDestroyed( WorldEvent e )
{
if ( profiling ) curms = MSTime();
if ( profiling ) ProfileTick();
// for gibber throttling
if ( e.Thing is 'mkBloodDrop' ) blods_realcnt--;
else if ( e.Thing is 'mkFlyingGib' ) meats_realcnt--;
if ( !e.Thing.default.bSHOOTABLE && !e.Thing.default.bMISSILE && !(e.Thing is 'Inventory') && !SWWMUtility.IsBeamProj(e.Thing) )
{
if ( profiling ) worldthingdestroyed_ms += MSTime()-curms;
if ( profiling ) ProfileTock(PT_WORLDTHINGDESTROYED);
return;
}
// remove from suckables
@ -245,18 +245,18 @@ extend Class SWWMHandler
pos = beams.Find(e.Thing);
if ( pos < beams.Size() )
beams.Delete(pos);
if ( profiling ) worldthingdestroyed_ms += MSTime()-curms;
if ( profiling ) ProfileTock(PT_WORLDTHINGDESTROYED);
}
override void WorldThingSpawned( WorldEvent e )
{
if ( profiling ) curms = MSTime();
if ( profiling ) ProfileTick();
// for gibber throttling
if ( e.Thing is 'mkBloodDrop' ) blods_realcnt++;
else if ( e.Thing is 'mkFlyingGib' ) meats_realcnt++;
if ( !e.Thing || SuppressMultiItem(e) )
{
if ( profiling ) worldthingspawned_ms += MSTime()-curms;
if ( profiling ) ProfileTock(PT_WORLDTHINGSPAWNED);
return;
}
IWantDieSpawn(e);
@ -441,6 +441,6 @@ extend Class SWWMHandler
trk.maxhealth = trk.lasthealth = e.Thing.Health;
trk.intp.Reset(trk.lasthealth);
}
if ( profiling ) worldthingspawned_ms += MSTime()-curms;
if ( profiling ) ProfileTock(PT_WORLDTHINGSPAWNED);
}
}