Skip to content

Complete Flash Profiler – It’s getting serious!

December 23, 2010

There was the first version, that wasn’t even looking like a profiler..
Then there was FlashPreloadProfiler Alpha and Beta..
But often I had to fallback on Flex Profiler to do the Performance Profiling.

Here is the first version that should be considered as a “fully qualified Flash AS3 profiler”.

Here is FlashPreloadProfiler RC1!

It has the basic features:
-Memory profiling
-Function Performance profiling (New!)
-Convivial UI (New!)

And it has the unique features:
-Overdraw graph
-Mouse Listeners graph
-Internal events graph
-DisplayObject Lifecycle graph
-Full Sampler recording “dump”
-Memory allocation/collection “dump” (New!)
-Function Performance “dump” (New!)
-Auto-Integration with De MonsterDebugger
-Run on debug/release SWFs

I can now officialy say that I don’t need any other tool anymore to optimize standard AS3 code. (Discussion on Molehill (Flash 3D) optimization will come soon!!)

There is a LOT of optimization that has been done in the profiler itself.
But the real new features are the new UI with ToolTips and lot’s of feedback. Plus the whole Function Performance profiling tool. There was also a lot of fixes in the code.

Here is the PerformanceMonitor screen:

This time, I’ve also made a full video of me explaining what the tool is all about and how to use it!
The video quality is very bad and I’m going to upload a better version really soon. Sorry!

Again, comments are very very welcome! You can post them on the google code project or right here on my blog.

If you want to participate, please send me a mail!
If you want to contribute financialy, there is a link on the profiler page and on the google code page.

Funny fact:
While developping the profiler, I ran Flash CS5 without removing the profiler first…
And I knew that FlashIDE was running SWF inside the main interface.. But to see that one of the main components was using some GrantSkinner library, that was just plain hillarious! Go check it out!

Reference:
FlashPreloadProfiler project

21 Comments
  1. Great work, man!

  2. Roy permalink

    I ran into a small bug –
    In the Memory profiler view, clicking “clear current data” can produce erroneous values, some huge number, in the [current] column. I’m guessing the [del] was bigger than the [add] in the frame and the [current] is saved in uint?

    Love your work, thank you so much.

    • Hey Roy,
      You are right, When I clear the data it’s not preceeded with a garbage collection, hence there will always be more negative than positive allocation, thanks for reporting! I’ll fix this as soon as possible.

  3. This looks great! My only problem is that it doesn’t seem to start up. I’m on Windows 7 and I’ve added both PreloadSWF and TraceOutputFileName to my mm.cfg per your instructions, but the profiler doesn’t show up. I’ve deleted my flashlog.txt and run the particle test you linked to, but no log is created. If I go to YouTube, a log is created but still no profiler shows up. Any tips on how to get this working? Thanks.

    • Hey Jackson! How are you doing?

      Well you should try to run a command prompt and do this:
      echo %homedrive%%homepath%

      This should tell you where FlashPlayer is looking for the mm.cfg file. if it’s not there just create it.

      also take a look here to validate that the flashplayer you are running is debug:
      http://kb2.adobe.com/cps/155/tn_15507.html

      And finaly if it doesn’t work try to run:
      http://technet.microsoft.com/en-us/sysinternals/bb896645

      and filter with “mm.cfg” you will see the flash player accessing the file, or at least trying to read it (even if it’s not created)

      Let me know if it works!

  4. Nice to have a such really helpful tool. jpauclair, thank you!

  5. Wow! I’m really excited about this.. gonna spend all Christmas with this! 🙂 Cool, Thanks!

  6. Héctor permalink

    Recently found out about your profiler, it looks great, and I’m eager to test it on some of my projects.

    About the Grant Skinner library… well, he worked, at least, in the project panel seen in Flash CS4 and CS5, so I do not think it’s strange if there are some more things made by him in there.

    BTW, you can know if you are running the debug version of the player if the “Show redraw regions” menu item appears when right-clicking a Flash movie.

  7. Great work, JP! Very nice tool. I like all the Flash-integration you have included.

    Does it remain usable if the application has a very low FPS? (for instance, say you are running at 5Hz and want to find out why)

    • I won’t say the profiler isn’t taking any process.. of course it does! even more with nice transparent UI 🙂
      But the case you are refering to, 5Hz, is a best case for this tool. it’s going to be slow while profiling, but the time taken by the profiler will be a lot less than the one of the application profiled.

      What I mean is the more “bug and lag” you have in your application, the more this kind of tool will help you.

      And If your application is already running quite smoothly, you might have some error due to the fact the the profiler is taking as much process as your application, but if it’s the case, you have to worry a lot less about your performance at this point! 😛

      Still, having access to a good profiler (professional one) is a must. This one should be seen as a “permanent” profiler. One that you can just let run all the time and if you think you might have some problem, just click the little icon on the top to find out what it is.

      I hope you’ll give it a try. I did use it a LOT of profiling with it on our molehill project and the result were very good. The profiling and debugging pipeline is much faster amd easier than with any other external tools.

    • I won’t say the profiler isn’t taking any process.. of course it does! even more with nice transparent UI 🙂 But the case you are refering to, 5Hz, is a best case for this tool. it’s going to be slow while profiling, but the time taken by the profiler will be a lot less than the one of the application profiled.

      What I mean is the more “bug and lag” you have in your application, the more this kind of tool will help you.

      And If your application is already running quite smoothly, you might have some error due to the fact the the profiler is taking as much process as your application, but if it’s the case, you have to worry a lot less about your performance at this point! 😛

      Still, having access to a good profiler (professional one) is a must. This one should be seen as a “permanent” profiler. One that you can just let run all the time and if you think you might have some problem, just click the little icon on the top to find out what it is.

      I hope you’ll give it a try. I did use it a LOT of profiling with it on our molehill project and the result were very good. The profiling and debugging pipeline is much faster amd easier than with any other external tools.

  8. Joe permalink

    This is awesome. Thank you for putting this out.

    I have a question about a potential leak with the code. I profiled the code below and under Memory Profiler, this leaks 31 flash.events::Event every second. Do you know if this is inherit in Flash’s MovieClip/Sprite or it’s the Profiler which is leaking? (I tried extending Sprite and it leaks the same).

    package
    {
    import flash.display.MovieClip;

    public class Main extends MovieClip
    {
    public function Main():void
    {
    }
    }
    }

    • Joe permalink

      Interesting, I only see this when I set the target to Release. I am using FlashDevelop with the following build command:

      Debug:

      mxmlc -load-config+=obj\PerformanceTestConfig.xml -debug=true -incremental=true -benchmark=false -static-link-runtime-shared-libraries=true -o obj\PerformanceTest634293100126866552

      Release:

      mxmlc -load-config+=obj\PerformanceTestConfig.xml -incremental=true -benchmark=false -optimize=true -static-link-runtime-shared-libraries=true -o obj\PerformanceTest634293100126866552

      Very weird that Debug doesn’t leak but Release does…

      • Joe, My first guess is that the event you are talking about is the enterFrameEvent. Please try to record the sampler data (see the video if you need help) and check out the new allocated object of type events. You’ll have the stacktrace.

        If this is the case, it’s might not be a leak at all. maybee the GC is just not trigger for a very long time. Try forcing it (trash can icon)

        give me some feedback once you have some more info.

  9. Joe permalink

    Jean-Philippe,

    I sampled as you said and I see some interesting things. I sampled for about 4-5 seconds and then pasted into Excel. I sorted on Column C (which is the NewObject, DeletedObject column), so DeletedObject-XXX and NewObject-XXX are in sequential order.

    If I scroll through the NewObject-XXXX, I come across these two rows:

    1214418638079 30033 NewObject-3742 Type: [class Event]
    1214418638079 30033 NewObject-3742 Type: [class Event]

    However, there is only one corresponding DeletedObject

    1214418702093 1971 DeletedObject-3742

    The other interesting thing is that close to these rows, there are these three rows, which is 2 DeletedObject to one NewObject.

    1214418570048 32054 NewObject-3740 Type: [class Event]

    1214418638070 9 DeletedObject-3740
    1214418638070 9 DeletedObject-3740

    Possible bug? There is always 31 Adds and 30 Deletes, so it seems the first case shows a double counting of the NewObject, which would account for the extra Add.

    Or it’s a data dump/print issue and it’s just being printed twice for both cases 🙂

    Here is the sequential dump so it’s a little more in context:

    1214418538081 30066 NewObject-3739 Type: [class Event] [enterFrameEvent]()
    1214418568147 1901 DeletedObject-3738 [enterFrameEvent]()
    1214418570048 32054 NewObject-3740 Type: [class Event] [enterFrameEvent]()
    1214418602102 1975 DeletedObject-3739 [enterFrameEvent]()
    1214418604077 32050 OtherSample [enterFrameEvent]() [enterFrameEvent]()
    1214418636127 23 NewObject-3741 Type: [class Event] [enterFrameEvent]()
    1214418636150 1920 OtherSample [reap]() [enterFrameEvent]()
    1214418638070 9 DeletedObject-3740 [enterFrameEvent]()
    1214418638070 9 DeletedObject-3740 [enterFrameEvent]()
    1214418638079 30033 NewObject-3742 Type: [class Event] [enterFrameEvent]()
    1214418638079 30033 NewObject-3742 Type: [class Event] [enterFrameEvent]()
    1214418668112 26007 DeletedObject-3741 [enterFrameEvent]()
    1214418668112 -30042 OtherSample [reap]() [enterFrameEvent]()
    1214418694119 1345 OtherSample [render](),[pre-render]() [enterFrameEvent]()
    1214418695464 989 OtherSample [pre-render]() [enterFrameEvent]()
    1214418696453 890 OtherSample [pre-render]() [enterFrameEvent]()
    1214418697343 4750 NewObject-3743 Type: [class Event] [enterFrameEvent]()
    1214418702093 1971 DeletedObject-3742 flash.utils::Timer/_timerDispatch(),flash.utils::Timer/tick()
    1214418704064 31963 NewObject-3744 Type: [class Event] [enterFrameEvent]()

    ted

    • There is a couple thing here.

      First, the enterframe event can be both from your app or from the profiler itself. Yes, some objects created in the profiler will be shown there. Also, the GC might “skip” references or not garbage everything right away. it’s called a safe garbage collector. multiple object created at the same time might not be collected at the same time.

      But as you said, having twice the same ID is very weird. I’ll try to look into my code to see if there is any output problem.

      I would be very surprised that the same event (object) could be dispatched in both ApplicationDomain using the same ID.

      Thanks for the report, I’ll look into it!

  10. Kévin Struillou permalink

    Hello,

    First, thanks for this great tool 🙂

    I probably have the same problem as Joe :

    When the target is Release, this leaks 31 flash.events::Event every second.
    When it’s Debug, 1 flash.events::Event every second ( 31 Add and 30 Del ).

    Here is a dump :

    198135897340 29998 NewObject-313 Type: [class Event] [enterFrameEvent]()
    198135927338 64 DeletedObject-312
    198135927402 49940 NewObject-314 Type: [class Event] [enterFrameEvent]()
    198135977342 1981 DeletedObject-313
    198135979323 32014 NewObject-315 Type: [class Event] [enterFrameEvent]()
    198136011337 1988 DeletedObject-314
    198136013325 48012 NewObject-316 Type: [class Event] [enterFrameEvent]()
    198136013325 48012 NewObject-316 Type: [class Event] [enterFrameEvent]()
    198136061337 -48012 DeletedObject-314
    198136061337 8004 DeletedObject-315
    198136069341 1071 OtherSample [pre-render]()
    198136070412 24948 NewObject-317 Type: [class Event] [enterFrameEvent]()
    198136095360 1977 DeletedObject-316
    198136097337 48029 NewObject-318 Type: [class Event] [enterFrameEvent]()
    198136145366 1993 DeletedObject-317

    Hope this helps !

    Kévin

  11. thienhaflash permalink

    Just WOW, must be looking into the implementation !

    • It’s still VERY messy… at your own risk! haha I guess I should take the time to make it more clean…

  12. vitaLee permalink

    i get this error quite often
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at net.jpauclair::SampleAnalyzer/ProcessSampling()
    at net.jpauclair::FlashPreloadProfiler/OnEnterFrame()
    and one more minor thing
    when Memory Profiler opened i’m not able to interact with the display list below.

Trackbacks & Pingbacks

  1. Reverse engineering AMF3 Vector for Java | Parabolic Evidence

Comments are closed.