This is a utilitarian profiler for use with Flash. It works with the flash.sampler API.
The PBLabsProfiler is licensed under the GPLv3. The code is (c) 2010 Ben Garney. If you'd like to use it under a different license please contact Ben at ben DOT garney AT gmail DOT com.
There is an official forum for discussion, troubleshooting, and announcements on the PushButton Engine site. Thanks to PushButton Labs for donating forum space.
You need to be on a supported OS. Currently the prebuilt binary only works on OS X. (See the Hacking PBLabsProfiler section below for details on building for other platforms.)
You need to have a recent JRE installed. We have been using Java 2 Runtime Edition 1.5. If you are on OS X you already have this. If you are on windows, get the most recent JRE.
Running The Binary
If you have received a prepackaged ZIP with a JAR in it, you do not need to compile any files to use the profiler. Follow these steps:
- Unzip the PBLabsProfiler.zip to a location of your choosing.
If you are on Mac, open the terminal and run these commands:
chmod u+x PBLabsProfiler.sh
If you are on Windows, launch the windows JAR with the following command:
You may also be able to double click the JAR and launch it.
Confirm that the PBLabsProfiler app has come up and shown its UI. You should see output like the following:
INFO: PBLabs Profiler server started on localhost:4262
Close all web browsers and Flash Player instances. mm.cfg is only checked when Flash Player starts globally. You may need to modify the mm.cfg file and restart your system.
Find mm.cfg (see section 3), and:
- Add a line like:
You might want to turn on logging to a file, it makes debugging the stub a great deal simpler. Mine reads like this:
On OS X, your mm.cfg can be found in your home directory (you may have to create it if it doesn't exist), and your flashlog.txt can be found in ~/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt, once you have your mm.cfg set up properly. If everything seems right and you have no flashlog.txt, try rebooting.
- Add a line like:
Add Agent.swf to the list of trusted files using the Flash Player Settings Manager here
- Open Flash content with the Flash debug player active/installed. The profiler will automatically open new windows for each profiled SWF. Currently closing windows results in a crash.
Hacking on PBLabsProfiler
If you want to compile this tool from scratch or develop it, please read the following.
Compile Agent.as to Agent.swf. I use:
mxmlc Agent.as -target-player=10
Compile and run the Java project using Eclipse. FlashProfiler.java is the main class. Add all the .jars to your class path. You may need to get the appropriate version of SWT for your platform.
- Launch the profiler from Eclipse. You may have to pass the -XstartOnFirstThread command line/VM option for it to work on OS X. -d32 may also be required if you have 64bit VM.
- Continue with the first set of usage instructions starting with step 4.