Download
(171Kb)
Download
Updated: 05-17-06 04:45 AM
Pictures
File Info
Updated:05-17-06 04:45 AM
Created:unknown
Downloads:4,098
Favorites:23
MD5:

LuaProfiler

Version: 1.5.0.0
by: Shag [More]

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

Optional Files (0)


Post A Reply Comment Options
Unread 09-28-06, 11:33 PM  
wmrojer
A Deviate Faerie Dragon
 
wmrojer's Avatar
AddOn Author - Click to view AddOns

Forum posts: 13
File comments: 73
Uploads: 3
Public access to the WoW ACE svn has been removed.
Try http://www.wowace.com/files/LuaProfiler/ instead.
Report comment to moderator  
Reply With Quote
Unread 09-28-06, 11:21 PM  
Kinesia
A Kobold Labourer

Forum posts: 1
File comments: 4
Uploads: 0
svn.wowace.com

The svn tree you mentioned is missing from wowace.com currently.
Would it be possible for you to update the version here on wowinterface in the meantime perhaps?

Thanks,
Kinesia.
Report comment to moderator  
Reply With Quote
Unread 09-10-06, 04:16 AM  
rmet0815
A Kobold Labourer

Forum posts: 0
File comments: 2
Uploads: 0
would it be possible to add some kind of distributions? what I would like to see (and would be very informative) is something like:
a) distribute the value to
- 10 % fastest
- 10 % slowest
- 80 % normal
b) then give values for the fastest (fast/avg/slow), the slowest (fast/avg/slow) and the medium (fast/avg/slow)

The problem in the current view/display is, that if i look at the slowest, this can be a one time off (during gargabe collection e.g.) But if i would look at the the 10% slowest i get a MUCh better value (same for fastest and medium).

Optional would be to chose the % value by the user.

Now I do not know if something like this is feasible or not, but if, it would rock!

Thanx alot
Report comment to moderator  
Reply With Quote
Unread 08-23-06, 04:06 PM  
wereHamster
A Black Drake
 
wereHamster's Avatar
AddOn Author - Click to view AddOns

Forum posts: 80
File comments: 15
Uploads: 4
the latest version from svn (http://svn.wowace.com/root/trunk/LuaProfiler) should work properly again, I've even added a check to catch nested calls so all values should be accurate

an maia, you can add the function names yourself now that the code is in the svn repo
Report comment to moderator  
Reply With Quote
Unread 08-11-06, 07:11 AM  
Drooliog
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 55
Uploads: 2
Broken?

Does v1.5.0.0 even work? All I get is a list of functions that don't seem to be called ever (their count and all other stats stays at 0). Same with v1.4.0.0. About the only function that can be seen to have any activity is __framescript_meta:__index() (which gets called LOTS of times).

Yet v1.3.0.0 works perfectly well - lots of activity when I put in _OnUpdate etc.. Maybe v1.5/4 stopped working with a recent WoW patch?
Report comment to moderator  
Reply With Quote
Unread 08-03-06, 04:54 AM  
Maia
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 15
File comments: 6
Uploads: 4
Shag, I'd really like to ask for adding back the function name to the table. Neither is clicking through 20 functions helpful to quickly see whats going on, nor is it possible to do a screenshot, and the debug doesn't really help me either. Well, I could try to find out how to write a script that will convert LuaProfiler.lua from SavedVariables to a .csv to then import it into excel - but this is a pain, if it's comparably easy to add back the old column with the function name.

Regarding the size: if the window is too large if you'd add the columns, just scale it down.
Report comment to moderator  
Reply With Quote
Unread 06-20-06, 03:53 AM  
wereHamster
A Black Drake
 
wereHamster's Avatar
AddOn Author - Click to view AddOns

Forum posts: 80
File comments: 15
Uploads: 4
Re: Cannot work?

Originally posted by rophy
Code:
function ParserOnEvent() lib:OnEvent() end
It's an embedded library, not sure if this is related or not.
Get Iriel's DevTools and use '/dump ParserOnEvent' to find out if your function really is visible.
Report comment to moderator  
Reply With Quote
Unread 06-09-06, 11:43 PM  
rophy
A Fallenroot Satyr
AddOn Author - Click to view AddOns

Forum posts: 24
File comments: 126
Uploads: 7
Cannot work?

I want to track the OnEvent function of my addon, so I input "ParserOnEvent" on the function field, leave the object field empty, and press add, but nothing is added. I'm sure the function can be seen on global scope, it looks like this:

Code:
function ParserOnEvent() lib:OnEvent() end
It's an embedded library, not sure if this is related or not.
Last edited by rophy : 06-09-06 at 11:44 PM.
Report comment to moderator  
Reply With Quote
Unread 05-22-06, 10:32 AM  
Tinkerboom
A Kobold Labourer

Forum posts: 0
File comments: 4
Uploads: 0
Originally posted by Shag
There are limitations in debugprofilestart/stop.. It doesn't support nested calls.

And I think it is possible that the chatframes use the most CPU cycles (although all I can do is guess because you didn't tell which function exactly). I've already seen ChatFrame_OnEvent() be among the top functions, now if you have many addons that hook this function and do lots of string parsing etc. it can use much more ressources.
yeah, the only reason I'd think it's wrong is because 1.3 reported completely different values. But I'm a developer and I'm very aware of how resource intensive parsing text can be (especially with mods like scrolling combat text etc).
Report comment to moderator  
Reply With Quote
Unread 05-18-06, 11:39 AM  
wereHamster
A Black Drake
 
wereHamster's Avatar
AddOn Author - Click to view AddOns

Forum posts: 80
File comments: 15
Uploads: 4
Originally posted by Shark
adding OnEvent to 1.2 found more than 30 functions, 1.5 finds only 5.
I can't confirm that.. even with only two addons (LuaProfiler and Iriel's DevTools) 1.5 finds heaps of OnEvent functions.. but the dump contains only very few... but that's working as intendet because functions that have been called at least once are dumped to SV.
Report comment to moderator  
Reply With Quote
Unread 05-17-06, 07:51 AM  
Shark
A Defias Bandit

Forum posts: 3
File comments: 56
Uploads: 0
please bring function names back!

p.s.

adding OnEvent to 1.2 found more than 30 functions, 1.5 finds only 5.
Last edited by Shark : 05-18-06 at 03:18 AM.
Report comment to moderator  
Reply With Quote
Unread 05-17-06, 04:52 AM  
wereHamster
A Black Drake
 
wereHamster's Avatar
AddOn Author - Click to view AddOns

Forum posts: 80
File comments: 15
Uploads: 4
Originally posted by Maia
Well, I do know I can click on each line, but on some occasions it has been very handy to make a screenshot and then analyze it later
Just added the 'Dump' feature.. dump the data to SV and analyze it later
Report comment to moderator  
Reply With Quote
Unread 05-17-06, 04:50 AM  
wereHamster
A Black Drake
 
wereHamster's Avatar
AddOn Author - Click to view AddOns

Forum posts: 80
File comments: 15
Uploads: 4
Originally posted by Tinkerboom
defenatly something funky going on now, it's saying in a raid that my chatframes are the most cpu intensive. I kinda doubt that
There are limitations in debugprofilestart/stop.. It doesn't support nested calls.

And I think it is possible that the chatframes use the most CPU cycles (although all I can do is guess because you didn't tell which function exactly). I've already seen ChatFrame_OnEvent() be among the top functions, now if you have many addons that hook this function and do lots of string parsing etc. it can use much more ressources.
Report comment to moderator  
Reply With Quote
Unread 05-11-06, 02:36 PM  
Tinkerboom
A Kobold Labourer

Forum posts: 0
File comments: 4
Uploads: 0
defenatly something funky going on now, it's saying in a raid that my chatframes are the most cpu intensive. I kinda doubt that
Report comment to moderator  
Reply With Quote
Unread 05-07-06, 11:01 AM  
Maia
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 15
File comments: 6
Uploads: 4
The additional information is nice, but now the names of the functions are gone. Well, I do know I can click on each line, but on some occasions it has been very handy to make a screenshot and then analyze it later - e.g. if the addon you're trying to optimize is related to raiding... Any way to bring back the function names? I wouldn't matter if I had to scale down the entire frame to keep it visible
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: