From f72cdf65ce4750045a62c42451ace40c54f4e9f0 Mon Sep 17 00:00:00 2001 From: Hekili Date: Tue, 21 Apr 2020 13:33:39 -0400 Subject: [PATCH] More caching and debug snapshot info. --- Core.lua | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Core.lua b/Core.lua index 87c9c6e4c..4a025ca71 100644 --- a/Core.lua +++ b/Core.lua @@ -631,7 +631,6 @@ function Hekili:GetPredictionFromAPL( dispName, packName, listName, slot, action self:AddToStack( scriptID, "items", caller ) rAction, rWait, rDepth = self:GetPredictionFromAPL( dispName, "UseItems", "items", slot, rAction, rWait, rDepth, scriptID ) if debug then self:Debug( "Returned from Use Items; current recommendation is %s (+%.2f).", rAction or "NO ACTION", rWait ) end - self:PopStack() else local name = state.args.list_name @@ -698,6 +697,17 @@ function Hekili:GetPredictionFromAPL( dispName, packName, listName, slot, action if readyFirst then local hasResources = true + for i, v in ipairs( Block ) do + for key, value in pairs( v ) do + self:Debug( "Block[ %d ]: %s, %s", i, key, tostring(value) ) + end + end + for i, v in ipairs( Stack ) do + for key, value in pairs( v ) do + self:Debug( "Stack[ %d ]: %s, %s", i, key, tostring(value) ) + end + end + if hasResources then local aScriptPass = self:CheckStack() local channelPass = not state.channeling or self:CheckChannel( action, rWait ) @@ -1010,6 +1020,7 @@ function Hekili:GetNextPrediction( dispName, packName, slot ) self:ResetSpellCaches() state:ResetVariables() + scripts:ResetCache() local display = rawget( self.DB.profile.displays, dispName ) local pack = rawget( self.DB.profile.packs, packName ) @@ -1191,7 +1202,11 @@ function Hekili:ProcessHooks( dispName, packName ) while( event ) do + local eStart + if debug then + eStart = debugprofilestop() + local resources for k in orderedPairs( class.resources ) do @@ -1250,10 +1265,11 @@ function Hekili:ProcessHooks( dispName, packName ) action, wait, depth = self:GetNextPrediction( dispName, packName, slot ) if not action then - if debug then self:Debug( "Time spent on event #%d PREADVANCE: %.2fms...", n - 1, debugprofilestop() - actualStartTime ) end + if debug then self:Debug( "Time spent on event #%d PREADVANCE: %.2fms...", n, debugprofilestop() - eStart ) end if debug then self:Debug( 1, "No recommendation found before event #%d (%s %s) at %.2f; triggering event and continuing ( %.2f ).\n", n, event.action, event.type, t, state.offset + state.delay ) end state.advance( t ) + if debug then self:Debug( "Time spent on event #%d POSTADVANCE: %.2fms...", n, debugprofilestop() - eStart ) end event = events[ 1 ] n = n + 1 @@ -1267,7 +1283,7 @@ function Hekili:ProcessHooks( dispName, packName ) break end - if debug then self:Debug( "Time spent on event #%d: %.2fms...", n - 1, debugprofilestop() - actualStartTime ) end + if debug then self:Debug( "Time spent on event #%d: %.2fms...", n - 1, debugprofilestop() - eStart ) end end if not action then