allows to trace functions calls and prints how much time was spent there on average and peak and how much time (in %) was spent in the function.
Usage:
To open the window use this slash command: /profiler
The left editbox is for the scope pattern (leave empty if you want to trace global functions), the right editbox is for the function pattern. Enter the patterns and press 'Add', depending on how much functions this addon has to hook it may take some time.
The frame isn't updated automatically, press one of the column headers to refresh the view. You can sort the data by all the columns, just press the column header.
Press 'Reset' to reset all trace data (does not unhook, only resets statistics)
Press 'Clear' to unhook all functions, and 'Ok' to close the window.
If you press one of the trace-lines it prints a summary to the chatframe, hold SHIFT while clicking the line to unhook the function, press CONTROL while clicking the line to reset the trace data for one particular function.
NOTE: If you are playing under linux (under wine, not confirmed under cedega), edit LuaProfiler.lua and at the very top of the file set 'LINUX_HACK' to 1000000 (number, 1 million).
NOTE: If you are playing under Widows, make sure hat LINUX_HACK is '1' (number, one), I often forget to change it before I make the release.
EXAMPLES:
To trace blizzards OnUpdate functions set the function pattern to "_OnUpdate"
If you have an addon that was designed in an OO way, add the 'class' name to the scope input field, I trace coolDown by setting the scope field to 'coolDown'. You also can trace LuaProfiler itself, set the scope to 'LuaProfiler'
Column Labels
Each label has four letters, the first incidates the type ('C' == Calls, 'T' == Time, 'M' == Memory, 'G' == Garbage Collection), the second and third how the data was gathered ('pC' = per Call, 'pS' == per Second, 'sR' == since (last) Reset) and the fourth the sub-types ('H'/'A'/'L' = High/Average/Low).
examples:
CsRC = Calls since (last) Reset (the last 'C' means nothing, yet )
TpCA = Time per Call Average - Average time per call spend in the functions
MpCH = Memory per Call High - the highest amount of memory allocated by one call.
GsRC = Garbage collections since (last) Reset
DUMP
by pressing the 'Dump' button, all stats for functions taht have been executed at least once are dumped into the SavedVariables file. I recommend a lua-script for analyzing the data. Here is a stub:
Code:
dofile("LuaProfiler.lua")
for dumpIndex, dumpTable in LuaProfilerDumps do
print("Inspecting dump #"..dumpIndex)
for _, traceInfo in dumpTable do
print("Function \""..traceInfo.functionName.."\" has been executed "..traceInfo.stat["CsRC"].." times")
end
end
CREDITS
credits go to 'Gello', he has created the beautiful addon
OnEventWatch and everything I've done is based on that.
ChangeLog
1.5.0.0
- added 'Dump' button to dump the stats to the SavedVariables.
1.4.0.0
- reworked interface
- much more statictical data shown
1.3.0.0
- now also displaying:
~ memory usage (in kbytes)
~ how many times the GC was triggered.
1.2.0.0
- fixed typo in function argument list
1.1.0.0
- now shows usage for all traced function right of the input fields