This isn't some quick test where I test it with a quick call to dump, it's maintained lowest result of the course of any length of time with real-world diagnostics. It is as accurate as it's going to get without it being run as a separate program/thread entirely with high priority.
KBM's latest version has this in it, and is constantly watching it's own 3 main handlers which give reports. Buff additions, Unit Availability and the Main System.Update.Begin handler.
Code:
function KBM:BuffAdd(unitID, Buffs)
-- Used to manage Triggers and soon Tank-Swap managing.
local TimeStore = Inspect.Time.Real()
if KBM.Options.Enabled then
if KBM.Encounter then
if unitID then
for BuffID, bool in pairs(Buffs) do
local bDetails = Inspect.Buff.Detail(unitID, BuffID)
if bDetails then
if not KBM.Buffs.Active[unitID] then
KBM.Buffs.Active[unitID] = {
Buff_Count = 1,
}
else
KBM.Buffs.Active[unitID].Buff_Count = KBM.Buffs.Active[unitID].Buff_Count + 1
end
KBM.Buffs.Active[unitID][BuffID] = bDetails
if KBM.Trigger.Buff[KBM.CurrentMod.ID] then
if KBM.Trigger.Buff[KBM.CurrentMod.ID][bDetails.name] then
TriggerObj = KBM.Trigger.Buff[KBM.CurrentMod.ID][bDetails.name]
if TriggerObj.Unit.UnitID == unitID then
KBM.Trigger.Queue:Add(TriggerObj, unitID, unitID, bDetails.remaining)
end
end
end
if KBM.Trigger.PlayerDebuff[KBM.CurrentMod.ID] ~= nil and bDetails.debuff == true then
if KBM.Trigger.PlayerDebuff[KBM.CurrentMod.ID][bDetails.name] then
TriggerObj = KBM.Trigger.PlayerDebuff[KBM.CurrentMod.ID][bDetails.name]
if LibSRM.Group.UnitExists(unitID) ~= nil or unitID == KBM.Player.UnitID then
if KBM.Debug then
print("Debuff Trigger matched: "..bDetails.name)
if LibSRM.Grouped() then
print("LibSRM Match: "..tostring(LibSRM.Group.UnitExists(unitID)))
end
print("Player Match: "..KBM.Player.UnitID.." - "..unitID)
print("---------------")
dump(bDetails)
end
KBM.Trigger.Queue:Add(TriggerObj, unitID, unitID, bDetails.remaining)
end
end
end
if KBM.Trigger.PlayerIDBuff[KBM.CurrentMod.ID] then
if KBM.Trigger.PlayerIDBuff[KBM.CurrentMod.ID][bDetails.type] then
TriggerObj = KBM.Trigger.PlayerIDBuff[KBM.CurrentMod.ID][bDetails.type]
if LibSRM.Group.UnitExists(unitID) ~= nil or unitID == KBM.Player.UnitID then
if KBM.Debug then
print("Debuff Trigger matched: "..bDetails.name)
if LibSRM.Grouped() then
print("LibSRM Match: "..tostring(LibSRM.Group.UnitExists(unitID)))
end
print("Player Match: "..KBM.Player.UnitID.." - "..unitID)
print("---------------")
dump(bDetails)
end
KBM.Trigger.Queue:Add(TriggerObj, unitID, unitID, bDetails.remaining)
end
end
end
if KBM.Trigger.PlayerBuff[KBM.CurrentMod.ID] then
if KBM.Trigger.PlayerBuff[KBM.CurrentMod.ID][bDetails.name] then
TriggerObj = KBM.Trigger.PlayerBuff[KBM.CurrentMod.ID][bDetails.name]
if LibSRM.Group.UnitExists(unitID) ~= nil or unitID == KBM.Player.UnitID then
if KBM.Debug then
print("Buff Trigger matched: "..bDetails.name)
if LibSRM.Grouped() then
print("LibSRM Match: "..tostring(LibSRM.Group.UnitExists(unitID)))
end
print("Player Match: "..KBM.Player.UnitID.." - "..unitID)
print("---------------")
dump(bDetails)
end
KBM.Trigger.Queue:Add(TriggerObj, unitID, unitID, bDetails.remaining)
end
end
end
if KBM.TankSwap.Active then
if KBM.TankSwap.Tanks[unitID] then
if KBM.TankSwap.DebuffName[bDetails.name] then
KBM.TankSwap.Tanks[unitID]:BuffUpdate(BuffID, bDetails.name)
end
end
end
end
end
end
else
if unitID then
for BuffID, bool in pairs(Buffs) do
local bDetails = Inspect.Buff.Detail(unitID, BuffID)
if bDetails then
if not KBM.Buffs.Active[unitID] then
KBM.Buffs.Active[unitID] = {
Buff_Count = 1,
}
else
KBM.Buffs.Active[unitID].Buff_Count = KBM.Buffs.Active[unitID].Buff_Count + 1
end
KBM.Buffs.Active[unitID][BuffID] = bDetails
if KBM.Trigger.EncStart["playerBuff"] then
if KBM.Trigger.EncStart["playerBuff"][bDetails.name] then
TriggerMod = KBM.Trigger.EncStart["playerBuff"][bDetails.name]
if TriggerMod.Dummy then
KBM.CheckActiveBoss(TriggerMod.Dummy.Details, "Dummy")
end
end
end
end
end
end
end
end
local TimeEllapsed = tonumber(string.format("%0.05f", Inspect.Time.Real() - TimeStore))
local TimeLeft = Inspect.System.Watchdog()
KBM.Watchdog.Buffs.Count = KBM.Watchdog.Buffs.Count + 1
KBM.Watchdog.Buffs.Total = KBM.Watchdog.Buffs.Total + TimeEllapsed
if KBM.Watchdog.Buffs.Peak < TimeEllapsed then
KBM.Watchdog.Buffs.Peak = TimeEllapsed
end
if KBM.Watchdog.Buffs.wTime > TimeLeft then
KBM.Watchdog.Buffs.wTime = TimeLeft
end
end But, since you asked, that's just the buff handler. I obviously wouldn't place the time tracing at the top, that would be incredibly stupid.
But, even if the Peak sits at 0.05 the results for the Watchdog do not change, ever. If you add a dump call to inspect in any of the 3 handlers in KBM, I get the same number, no mater the Peak time nor the actual handler duration. And the wTime variable (which initializes to 99 btw) is always stuck at 0.100...stupid float here.
Bookmarks