TraceEvent - Dynamic Lua code profiling
I've finished up the next version of my Lua code profiler:
Quote:
TraceEvent can can also help you find stuff buried in Blizzard's interface customization kit. Trace "^%a+_" and then watch the functions as you do stuff. For example, if you want to customize mail: reset the trace stats, open a mailbox, then sort the trace stats. The top functions listed will be related to mail. (Sometimes you have to stop tracing some "noisy" code like ActionButtons in order to find the good stuff.) WoW Interface download http://www.wowinterface.com/download...php?s=&id=4053 Main web page http://www.vulpes.com/TraceEvent/ |
Gave you a bit of free publicity, LJ.
|
hey littlejohn all my mods use a OO aproach to coding does this support them at all?
|
That's really slick. I like it a lot.
For suggestions, do you think it's possible to profile how much memory an addon is taking up? Or the amount of garbage it creates? |
I just uploaded v1.3 that can trace OO code.
Kaelten: That may have been the most polite feature request in history... :) I used your KC_EnhancedTrades to test. (That's a cool mod by the way. I'll have to study how you hook into the existing frames.) Do you know that TSF_Update uses 150-200 KB of memory each call? I don't think I've got a bug, but I've never seen a function use that much memory before. (_getShowState or _getCreationData might be the real culprits though -- they weigh in at 16 KB and 13 KB respectively.) One thing that's a bit nasty with my code is how OO method names are displayed -- there's a good chance the name will be truncated. Give it a try and let me know if you have any ideas. The pattern I used to trace your code was "KC_EnhancedTradesClass:". Gello: My code reports memory usage per function call so you can trace memory usage on a mod and then sort the display to see any hot spots. (Hold shift when pressing Sort to sort by memory usage.) Would it be useful to assume that all functions with a common prefix are part of the same mod and then total up memory usage for all those functions? I'm not sure how to figure global variable usage though. I'm only catching increases in memory usage, not the total level. If a mod sucks up 10 MB at startup, my code completely misses that. |
Quote:
It's a shame GetTime() only goes to three decimal places. Would rule to see how much processing time each mod was taking up too. Even with no change it's very nice :) If a bit frightening lol. I'll have to rethink my liberal use of table.sort. It's super fast but the memory use is huge. |
ya I know that TSF_Update is a nasty memory hog. Thats one of the reasons that I wanted your mod to work with mine so bad! hehe that way I Can actually trace and and mesure which method of doing things is actually better.
Thanks alot for this mod man, it might just make alot of pains in my life easier. |
Quote:
Quote:
|
how do I turn on mem display?
|
Press the shift key when you hit "Add" or "Reset" to enable memory collection on everything. Press the shift key when you hit "Sort" to sort by memory usage.
Press the shift key and left-click on an individual function to enable memory collection on just that function. (This is kind of annoying -- if you forget to hold shift you'll stop the trace on the function.) I think the next version is going to have a check box next to each function to turn this on and off. Scrolled check boxes, whee! |
ok.... here is a feature request list, hehe don't hate me.
1) it would be nice if the window had maybe one or two more rows, or maybe allow us to cofig the rows. 2) a global track memory usage toggle would be good too. 3) being able to have a seperate window with information about groups of function that would logically make up an addon. 4) being able to toggle memory tracking for an "addon" with a single click 5)you said it keeps track of cps over a 3 second window, if there is could be an option to change this it would be nice. 6)I noticed that I had to add OO by KC_EnhancedTradesClass: could it be possible to only add it by the instance? what if I had KC_EnhancedTrades and KC_EnhancedTradesAdv both based off the same class(bad example I know) and I wanted to track them seprately? 7) go buy yerself a beer or your spirit of choice for doing what looks like will be such a useful mod for developers. btw: it seems if you shift-click reset it will turn mem tracking on. |
Quote:
|
Quote:
When tracking "Recap_.+". A function named Recap_SortList includes just a table.sort, a post-sort insertion sort (for the life of me I can't get this secondary sort working inside the table.sort but that's another story) and a redo of gauges. The latter two looked fine (just a couple hundred bytes per call) but the Recap_SortList was generating ~250-300 kilobytes per call. (and the gcinfo() seemed to agree with the memory being eaten) But...just tracking "Recap_SortList" tracked with ~250 combatants, ~500 bytes per call of Recap_SortList. And the memory used from gcinfo() is back to barely noticable. I'm going to have endless fun with this. |
Quote:
|
Quote:
*Stops derailing the thread and buggers off out of the way again* |
Quote:
Quote:
Quote:
What I can do is catch the difference between a class table and an object instance table. If you give it an object table, TraceEvent could put a condition on the trace function that checks if the function is being called with the object you're interested in. If you give it a class table, TraceEvent will work the way it does now. Hmm. I think I made a mistake in the syntax. I should use "." for class tables and ":" for object tables. That's consistent with Lua call syntax -- you could trace "KC_EnhancedTradesClass." or "KC_EnhancedTrades:" Does that make any sense? Quote:
|
hehe, as far as the scrol being adjustable, it would just have to be 20 of them in there and then hide the uneeded ones
no way to make em dynamicaly sadly. |
would it also be possible to trace how long a function takes on average to run?
|
Quote:
One possible solution I'm working on is to run a function 1000 times, measure that, and then divide the time by 1000. Surprisingly this will probably work for all OnEvent and OnUpdate handlers. Other functions maybe not. YMMV. Batteries not included. |
what is the resolution of the GetTime() function
I throught I read somewhere that it was milisecond accurate |
All times are GMT -6. The time now is 01:01 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI