Skip to content

Commit

Permalink
More caching and debug snapshot info.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hekili committed Apr 21, 2020
1 parent bc04738 commit f72cdf6
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit f72cdf6

Please sign in to comment.