Stop Coding!

The Unofficial Flex Compiler Blog

The Future of The Flex Profiler

with 6 comments

If you haven’t read my previous blog about the Flex Profiler, I recommend you go take a look…

Ever since the Flex Profiler was made available in early FB3 beta, I’ve been hearing some legitimate concerns. One example and I paraphrase:

It’s great that Flex has implemented a large number of Eclipse views for the main use cases. But they are not showing me what I want…

Another example:

The steps of showing profiling data are quite simple and easy to remember. But once the data is shown, it seems to me that it usually takes too many steps to navigate to the root cause of the performance/memory problems. Why can’t the tool be smarter?

Like I said, these are legitimate concerns and I’m sure the Flex engineering team is going to improve the profiler going forward. How? I’m going to give my $0.02 here..

Just to recap, there are 4 pieces in the profiler architecture:

  1. The flash.sampler.* API support and the PreloadSwf support in the Player
  2. ProfilerAgent.swf as the PreloadSwf
  3. Java-based profiler client library
  4. Eclipse plugin + the graphical user interface

As you can see, if the current Flex profiler doesn’t work for you and you can’t wait for any improvements in the next release, your most logical option will be the flash.sampler API, i.e. write your own profiler agent or simply use the flash.sampler classes in your application. There are many advantages and disadvantages.

Advantages:

  • Free. You don’t have to pay several hundred dollars more for FB Pro. Well, your time is money too. so, this point doesn’t make sense. 🙂
  • Your profiler agent could be very lightweight if you know exactly what you’re looking for.

Disadvantages:

  • You want a profiler agent that is lightweight, i.e. not using up too much of CPU cycles and Player memory. However, it could take you a long time to write a good one.
  • You have to use another timing approach to verify the correctness of your implementation.
  • You may waste your valuable time if you have to move your sampling code from one wrong spot to another in your application.

I think most developers would avoid writing their own. At some point, some developers/software vendors may make theirs available (free of charge? who knows?). I don’t see that in my crystal ball yet.

If the current Flex profiler works for you but you want some enhancements, feel free to submit your enhancement requests. However, they may not work on every enhancement (e.g. they may not build 15 more new profiler views). Instead, you should tell Adobe the following:

  • Expose the API of the Java-based profiler client library. The API returns pre-calculated data that’s ready for tabulation. It can also return raw data from ProfilerAgent.swf if you want to do your own calculations.
  • Expose the API of the foundation classes (e.g. the base class of the performance/memory views) and the utility classes.
  • Define extension points in the Eclipse-based profiler plugin.

If Adobe listens to you and do the above, it will be very easy for you to extend the Flex profiler. I think it’s in their best interest to provide the flexibility you need because the Player doesn’t provide profiling support in a closed environment – the flash.sampler API is available to everyone. Sooner or later, the Flex Profiler will not be the only game in town.

Another great thing that developers can do if the API of the profiler client library is exposed is static code analysis. Did you notice that in the inclusion/exclusion filter dialog, it automatically shows a list of packages as you type?

The package list is built dynamically by the Flex Profiler by decoding the bytecodes in your application. Yep, the application SWF is available via the profiler client library API. That’s why I think someone could write a profiler extension plugin that uses SWFKit (the open source SWF encoding/decoding library) to decode and run static code analysis. It sure would be very nice to be able to do both static/dynamic code analysis with the Flex Profiler.

Advertisements

Written by Clement Wong

April 28, 2008 at 6:10 pm

Posted in profiler, Technology

Tagged with ,

6 Responses

Subscribe to comments with RSS.

  1. This is very important, I wish to lern all about the flex profiler.

    mirabilissimo100

    April 29, 2008 at 4:41 pm

  2. Since you seem to have the only article on the web that mentions the flash.sampler API, i thought I’d ask you a question. It seems that the flash.sampler API is not available in an AIR application. Even with the latest SDK.

    It just seems odd because I have never encountered an API that is available in Flex but not AIR. And also because it is obviously possible to run the Flex 3 Profiler on an AIR app, so these functions must be available at some level

    Alex

    June 2, 2008 at 6:41 pm

  3. Hi Alex, one quick question. Do you mean you can’t compile an AIR app that uses the sampler API or the AIR runtime says it doesn’t have the sampler API? The reason I ask, the player runtime and AIR runtime are two different runtime. For compiling, there is playerglobal.swc and there is airglobal.swc for AIR apps. If you see the error at runtime, make sure that your AIR app is in debug mode. If you get the error at compile time, make sure that the library path uses airglobal.swc.

    Clement Wong

    June 17, 2008 at 3:02 pm

  4. Somehow i missed the point. Probably lost in translation 🙂 Anyway … nice blog to visit.

    cheers, Mainly.

    Mainly

    June 18, 2008 at 9:13 pm

  5. I cannot get the flash.sampler.getMemberNames to work, it always returns an empty object. Is there something that needs to be set up to make it work?

    henry

    September 23, 2008 at 3:26 pm

  6. […] consider adding some openness to their IDE (and I already advocated that 2+ years ago in one of my posts about opening up the FB profiler). This makes common sense to me because if they can’t do […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: