Repository navigation
Profiling Flash and AIR
The Flash Profiler profiles AIR applications. It uses the telemetry that the AIR runtime itself sends, the same data Adobe Scout used to read: call stack samples, frames, rendering time, memory and garbage collection. No profiling code is added to your program. For what all profilers share, see Profiling Overview.
Note
Experimental. IntelliJ IDEA Ultimate. See Profiling Overview.
- IntelliJ IDEA Ultimate.
- An AIR application launched with a Haxe AIR Application run configuration, with Application descriptor: and
Flex/AIR SDK: set. For a Lime or OpenFL project built for the
airtarget, Build & run in the Haxe tool window creates this configuration. For an hxml AIR build, create it yourself; see Run Configurations. For the AIR SDK setup, see Set up the Flex/AIR SDK. Without a descriptor, Profile with 'Flash Profiler' in the Haxe tool window opens the configuration editor, titled Profiling Needs the Application Descriptor. - A runtime and SWF that support telemetry. Telemetry has existed since AIR 3.4 (see the AIR SDK's
Scout guide), and the plugin expects SWF version
17 or later. Lime's
airtarget builds for a new enough version by default. In an hxml file,--swf-versiontakes the Flash Player version:--swf-version 11.4produces SWF version 17, while Haxe's default is older.
SWF files that run in the standalone Flash Player (Haxe Flash Application) cannot be profiled.
- In the Haxe tool window, expand the build file's Actions group.
- Right-click Build & run and choose Profile with 'Flash Profiler'.
- The application starts and the tab in the Profiler tool window fills in while it runs.
- Close the application or stop the run. What reached the IDE until then is kept.
For a configuration you created yourself, select it in the run widget and start it with the Flash Profiler entry.
If your build sends trace output to the console (with -D native_trace, see
Debugging Flash and AIR), that output does not appear while the application is
profiled: the profiler starts the runtime in debug mode, and in that mode the runtime does not send traces to the
console.
-
In the build: adds
-D advanced-telemetrythrough the Run Haxe action before-launch step. This define lets the SWF send detailed telemetry. If your configuration builds without that step, add the define to your build yourself. -
At launch: starts
adlin debug mode. The runtime only takes call stack samples in this mode. -
For the run: writes the file
.telemetry.cfgin your home folder. The AIR runtime reads this file at startup to find out where to send its telemetry; the plugin points it at the IDE. If you already have a.telemetry.cfg, for example from Adobe Scout, the plugin sets it aside as.telemetry.cfg.ijhaxe-backupand puts it back when the run ends. If the IDE closes in the middle of a run, your file stays in the backup, and the next profiling run puts it back when it ends.
The Flash Profiler entry has no settings: the runtime samples at its own fixed interval of about 1 ms.
The profile is saved as captures/<date>-<time>/flashprofile.hxtsession next to the application descriptor.
The tab shows the standard Flame Graph, Call Tree and Method List views with CPU Time and Samples,
plus the Haxe Profiler tab. Time that the runtime spends outside your code appears as entries in brackets:
[render] for rendering, [gc] for garbage collection, [idle] for waiting and [script] for script time without
a sample. The telemetry names the functions but carries no source positions, so the editor hints show times per
function, and navigation finds the function by its name.
| Lane | Data | Empty when |
|---|---|---|
| Call chart | Sampled call stacks of the main thread, plus the bracketed entries above. | - |
| Frames | One span per display frame, from the start of one frame to the start of the next. Click a frame to see its time split into scripting, rendering, GC and idle. | - |
| GC | The garbage collection time of each frame. The span's position is only accurate to the frame. | No collection happened. |
| Memory | Heap used and Heap reserved of the runtime's managed memory, per frame. | - |
| CPU load | Thread activity: how busy the main thread was over time, estimated from the samples. | - |
| Events, GPU memory, GPU load | Not recorded by this profiler. | Always. |
- Only AIR applications launched with Haxe AIR Application can be profiled, not the standalone Flash Player.
- The profile shows a single thread, the main one.
- Console
traceoutput (-D native_trace) is not shown during a profiling run. - The profiler starts with the application; it cannot attach to a running one.
-
.telemetry.cfgis read by every AIR and Flash runtime that starts under your user account, not only by the profiled application. The plugin replaces it only for the duration of a profiling run.
| Symptom | Cause and fix |
|---|---|
| No profiling data arrived - telemetry needs swf-version 17+ ... | The SWF version is too old, the runtime has no telemetry support or the build lacks -D advanced-telemetry. Raise the SWF version, and profile through Build & run or a configuration with a Run Haxe action step. |
| Profile with 'Flash Profiler' is missing for a Flash build | The build produces a SWF for the standalone Flash Player. Only AIR builds can be profiled. |
Console trace output is missing |
Expected during profiling; use a normal run to see it. |
Getting started
Working with projects
- The Haxe Tool Window
- Build Files
- Targets and Sections
- Resolve Context
- Libraries and Haxelib
- Defines and Custom Targets
- Building and Running
- Run Configurations
- Tools
- Compilation Server
Debugging
Testing
Profiling
Editing code
- Code Completion
- Diagnostics and Inspections
- Refactoring and Navigation
- Formatting and Code Style
- Conditional Compilation
- Editor Extras
Reference