Project Monocle (codename) is an upcoming tool from Adobe to profile ActionScript 3 (Flash Player and AIR) applications on both desktop and mobile. It provides an amazing level of insight into just about all aspecs of an application across time. If you would like a general overview of its capabilities, here is a nice video.
Monocle has been in private beta for some time now, and was recently made available much more widely through a public beta program:
— Thibault Imbert (@thibault_imbert) October 15, 2012
Note that even though the beta is now public, I believe many things are still restricted to the NDA agreement of the prerelease program, so I will not be getting into any specifics in this article about Monocle usage itself. Basically, so long as Monocle is running on your system, any SWF with advanced telemetry enabled will be able to be profiled within the application when it is run from a website, development environment, mobile device, or whatever.
Using Flash Builder 4.7
The easiest way to get going with Monocle is to use the beta 2 of Flash Builder 4.7 to enable telemetry and compile your projects. The process is super easy as there is a little checkbok (Enable detailed telemetry) in the ActionScript Compiler section of the project properties dialog which allows you to easily turn this feature on and off.
There are a few things to note in regard to this, however. This option is only available on pure ActionScript projects since at this time, only pure AS3 projects can be compiled using ASC2.0 – which is the compiler FB4.7 uses to compile AS3 projects and insert the telemetry features into the compiled app. As a result, you cannot use this with Flex projects with Flash Builder (yet, anyway).
Once telemetry has been enabled for a project, the next step would be to run the Monocle application so that it is listening for telemetry data. Starting a capable SWF (using Flash Player 11.4 or AIR 3.4 and above) will trigger a new Monocle profiling session.
In the above example, I’m using a simple Hallowe’en themed Away3D AS3 project in FB4.7 with advanced telemetry enabled in order to test out Monocle. Since Monocle has some rather special Stage3D profiling features, this will enable me to profile the full range of available options provided by the application.
Switching over to Monocle, we can see that all of the data for this session has been collected in gorgeous detail. One of the things that is really impressive with the project is that all of this data is interactive – even the Stage3D bits!
Using Flash Professional
If using older Flash Player and AIR projects in Monocle, we have an alternative to re-compiling everything through FB4.7 – we can even use this method along with Flash Professional CS6! This method takes a previously compiled SWF and runs it against a small Python script to shuffle the bits around and enable telemetry.
NOTE THAT THIS METHOD IS NOT A FINAL SOLUTION BUT SIMPLY WHAT WE MUST USE AT THIS PRESENT TIME IF NOT COMPILING WITH FB4.7
The first thing we need to do is get Python installed on the system we’ll be working with. I’m using a Windows 7 machine so downloaded the .msi installer which provided an option to add Python to my PATH options. Very convenient.
After installation, we can then open up a command prompt and run the script (add-advanced-telemetry.py) that comes bundled with the Monocle package, feeding in the SWF we wish to enable telemetry on as an argument. Again, this isn’t the best way to enable telemetry… but with some trial and error – it is workable.