Skip to content

Instantly share code, notes, and snippets.

@SafeteeWoW
Last active December 5, 2017 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SafeteeWoW/7a4a63770870af06717830d871619242 to your computer and use it in GitHub Desktop.
Save SafeteeWoW/7a4a63770870af06717830d871619242 to your computer and use it in GitHub Desktop.
local requestTime = {}
local frame = _G.TestGetItemInfo or CreateFrame("Frame", "TestGetItemInfo")
frame:RegisterEvent("GET_ITEM_INFO_RECEIVED")
frame:SetScript("OnEvent", function(self, event, id)
if requestTime[id] then
print(format("%d", (GetTime()-requestTime[id])*1000) .. " ms", " ", id) --Time between request and receive"
end
end)
local function TestGetItemInfo()
local id = 0
while not GetItemInfoInstant(id) do
id = math.random(1, 200000)
end
requestTime[id] = GetTime()
GetItemInfo(id)
C_Timer.After(1, TestGetItemInfo) -- Repeat every 1s
end
TestGetItemInfo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment