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.
If you can not get your profiler working, there are few methods you should try:
- close all other tabs
- install debug player
- change browser
- change port
- disable firewall / antivirus
- define PreloadSwf path
- localhost / 127.0.0.1
- allocate console
- ultimate methods (what worked for me)
Update (Feb 12, 2010): Close all other tabs
Fastest thing to do is to close all other tabs in your browser, close all other instances of browser and than try profile again.
Install debug player
Make sure you have installed debug version of flash player. Well, you probably have… so skip this one.
It may seem to be weird but it works. All browsers (chrome, opera, ff) except for internet explorer use same flash player, switching to any other browser may fix your profiling. You can change browser in flex / window / preferences / general / web browser / use external / add …
Try change default port (flex / window / preferences / flex / profiler / connections / port number) to something else (7777, 8888), there were reports that simple port change helped to solve problem.
Disable firewall / antivirus
Do this on your own, if you are not sure about what you are doing call admin. The aim is to unblock port that is used for profiling. Try disable default windows (os) firewall or make exception. To make exception on your eset smar security use following procedure:
- Open Smart Security.
- If you are in standard mode and do not see a menu in the top right hand corner click Setup->Toggle Advanced Mode.
- Click on the ‘Enter entire advanced setup tree…’ link at the bottom.
- Click Personal Firewall->Protocol Filtering.
- Make sure ‘Enable application protocol content filtering’ is selected.
- Below that select Redirect traffic for filtering->HTTP and POP3 ports.
Define PreloadSwf path
If your IDE does not edit your mm.cfg file properly, change PreloadSwf property in manually. This is undocumented, but adding the property manually is reported as working solution. Try add the following line to the file
If 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: C:/...flexworkspace/.metadata/.plugins/com.adobe.flash.profiler/ProfilerAgent.swf?host=localhost&port=9999
Make sure path directs to local trusted area!
localhost / 127.0.0.1
If the profiler in Flash Builder does not work, check if localhost does resolve to 127.0.0.1 on your machine. If not fix the hosts file. – Mario Klingemann (quasimondo)
If the Flash Profiler does not start: switch off “Allocate Console” in the Profile Configurations Common tab. – Mario Klingemann (quasimondo)
Ultimate methods (what worked for me)
I spent almost hour trying to figure out why my profiler wont connect in one workspace and works just fine in another even with same settings. I tried every mentioned method but niether worked. While randomly trying all methods I finally came to something new:
Profiling can only be performed on the debug version of an application.
What the hell? Of course I am using debug player and pushing “profile it” button so what is wrong? I tried reinstall player to other versions but did not worked. Well, if you were able to came this far you may wonder what solution I finally figurd out. It is definitely not elegant solution nor correct but works, thats why I called it ultimate 🙂 . Click profile button as fast as you can (5 times in row) and behold! Randomly you get your profile perspective connected and working (if not, try few times)! So definitely a flex bug.