# HG changeset patch # User Zerotorescue # Date 1296398416 -3600 # Node ID 38cc9221202d4a70860ceeed3e675d112b7b4419 # Parent 210cf5679fc14b2d1fa8bcf1d1296783339e9080 Added a test page used to determine loading times. diff -r 210cf5679fc1 -r 38cc9221202d Core.lua --- a/Core.lua Sun Jan 30 15:39:53 2011 +0100 +++ b/Core.lua Sun Jan 30 15:40:16 2011 +0100 @@ -1,3 +1,9 @@ +--@debug@ +IMStartLoadTime = GetTime(); +collectgarbage("collect"); +IMStartLoadMemory = collectgarbage("count"); +--@end-debug@ + -- You can access this addon's object through: LibStub("AceAddon-3.0"):GetAddon("Inventorium") local addon = select(2, ...); addon = LibStub("AceAddon-3.0"):NewAddon(addon, "Inventorium", "AceEvent-3.0"); diff -r 210cf5679fc1 -r 38cc9221202d Inventorium.toc --- a/Inventorium.toc Sun Jan 30 15:39:53 2011 +0100 +++ b/Inventorium.toc Sun Jan 30 15:40:16 2011 +0100 @@ -36,3 +36,8 @@ # Optional addon support Plugins\Plugins.xml + +# Debug page to monitor resource usage +#@debug@ +Test.lua +#@end-debug@ diff -r 210cf5679fc1 -r 38cc9221202d Test.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Test.lua Sun Jan 30 15:40:16 2011 +0100 @@ -0,0 +1,15 @@ +-- Loading time (in seconds) +print("Data loaded in: " .. GetTime() - IMStartLoadTime .. " seconds."); +IMStartLoadTime = nil; + +local currentMem = collectgarbage("count"); + +-- Memory usage for addon (in kbytes) +print("Memory gained since start of loading: " .. (currentMem - IMStartLoadMemory) .. " kbytes."); +IMStartLoadMemory = nil; + +-- Collect garbage +collectgarbage("collect"); + +-- Memory usage for this addon after trash was emptied +print("Memory gained since start of loading after garbage collection: " .. (currentMem - collectgarbage("count")) .. " kbytes.");