An AddOn for displaying the time spent inside functions, to help find bottle necks in code. For developers only.
This AddOn is used exclusively through slash commands.
Enabling/Disabling CPU Profiling
- /fp e
Enable CPU Profiling.
This uses extra CPU cycles, even when the AddOn isn't running, so be sure to turn it off when you're done. This will cause the user interface to be reloaded.
- /fp d
Disable CPU Profiling.
This will cause the user interface to be reloaded.
By default, FunctionProfiler watches _G.
- /fp a [function | table]
Add a watch for a function or table.
Tables and their metatables are recursively checked for functions, and all found functions are added.
- /fp l
Lists all watched functions or tables.
- /fp r [function | table]
Removes a watched function or table.
- /fp rs
Rescans watched tables, useful if what you wanted to watch didn't exist when the AddOn was loaded.
- /fp f pattern
Filters watched functions using a Lua pattern.
The above slash commands can of course only watch things that are globally visible. This AddOn creates two global functions which you can call from inside your AddOn to watch local variables.
- AddFunctionWatch([function | table], name)
Watches a function or table. name is used for display purposes.
- RemoveFunctionWatch([function | table])
Removes a watch previously added by AddFunctionWatch().
The Graph Window
- /fp s
Shows the graph window.
- /fp h
Hides the graph window.
The graph window can be dragged around using the left mouse button. The mouse wheel will increase or decrease the number of objects displayed. Right clicking changes how the items are sorted.
- Exclusive Time
Sort by the total time spent inside a function, not counting time spent in functions that it called.
- Inclusive Time
Sort by the total time spent inside a function, including time spent inside functions that it in turn called.
- Inclusive Time Per Call
Sort by the average total time spent inside a single call to a function, including the time spent in functions that it in turn called.
- Exclusive Time Per Call
Sort by the average time spent inside a single call to a function, not counting time spent in functions that it called.
When displaying inclusive calls, the bright part is the time spent inside the function in question, the dark part is time spent in functions that it called.
When a function can be seen from multiple locations, the one that would result in the shortest name is displayed.
The time between when a co-routine yields and when it is resumed counts towards the execution time of the function that yielded.
The code that searches for functions tries to find the shortest function name; if your filter is applied to a table that was found under multiple names, and a shorter name was discovered that didn't match the pattern first, any longer names, even if they do match, will be filtered anyway. I expect filtering works properly in most cases, and that the effort of checking every possible permutation isn't worth it.