I’ve just wasted quite a few hours getting the Flex Profiler to work, and maybe I can share my dearly earned knowledge on the subject. So first, a few words on how the profiler works:
The profiler is a part of the Flex Builder IDE, that listens for messages from the profiler agent. The profiler agent is a swf launched in parallel to your main swf. It is located in your Flex workspace at .metadata/.plugins/com.adobe.flash.profiler/ProfilerAgent.swf. Your IDE gets this agent to start by editing your mm.cfg and adding a “PreloadSwf” line. The agent uses the flash.sampler.* API to gather data on your main swf, and sends it to the IDE using TCP on a preconvened port. This port is 9999 by default, you can change it in Preferences/Flex/Profiler/Connections.

Now, where can this stuff mess up?
– your firewall can be blocking the communication. Make sure it lets the info through!
– your IDE doesn’t edit your mm.cfg file properly. This is completely undocumented, but adding the info manually works. I added the following line to the file:
– you got the the path to the profile agent wrong. You can check this by looking in the flash text logs. If the preload went wrong, you should see a message like

PreloadSwf paths must be local trusted: D:/ariel/projets info/repository/client/flex/.metadata/.plugins/com.adobe.flash.profiler/ProfilerAgent.swf?host=localhost&port=9999

right at the beginning of the file.
– You’ve gotten so far and are ready to give up all hope? Fear not, I have one more completely unexplained hack for you: try another browser. In Preferences/General/Web Browser you can change the browser used at launch. Somehow Firefox wasn’t working for me, so I tried with Internet Explorer and it worked. Don’t ask…

Some thoughts on the mess: Adobe, you have a very useful, free profiler. But WTF? I had to scour the net for hours to gather this info! We need documentation! The source to the profiler agent would be nice. I suppose I could decompile it now that I know where to find it, but still… The community could contribute to improving both the agent and the ide part.

And finally, some references:
– The only article I found about the profiler written by someone who has something to do with it :

– where is your mm.cfg file?
http://livedocs.adobe.com/flex/3/html/help.html?content=logging_04.html Note that there is no mention of PreloadSwf
– a post in french that tipped me off about editing the mm.cfg file manually.

If you’re having some trouble, feel free to ask some questions, I’ll try to help. I feel for you. Really.

Pin It