Any Scaleform application may be configured to support remote profiling by AMP by following the steps outlined in this section. Also, the Scaleform Player source can be examined for an example of a fully-configured AMP server.
AMP has the ability to use ActionScript 2 Flash debug information (SWD files) to display source code and per-line timings. Generate SWD files by running the debugger (Ctrl+Shift+Enter) from within Flash CS3 or CS4. Place the SWD file either in the same location as the corresponding SWF, or in the working directory of the AMP client.
For ActionScript 3, there are no SWD files, and debug information is embedded directly into the SWF. AS files are needed to display the source code. Generate debug SWF files by running the debugger from within Flash Studio.
AMP has the ability to remotely control settings in the profiled application, such as wireframe mode, or batch profiling mode. Many of the supported settings are application-specific, and may be implemented by the application. Any such functionality not implemented will simply not be available via the AMP client.
Follow the steps outlined below to handle app-control messages sent from AMP:
Inform AMP of the supported functionality by calling AMP::Server::GetInstance().SetAppControlCaps. The argument to this method is a AMP::MessageAppControl message, with the supported functionality set to true. For example:
AMP::MessageAppControl caps; caps.SetCurveToleranceDown(true); caps.SetCurveToleranceUp(true); caps.SetNextFont(true); caps.SetRestartMovie(true); caps.SetToggleAaMode(true); caps.SetToggleAmpRecording(true); caps.SetToggleFastForward(true); caps.SetToggleInstructionProfile(true); caps.SetToggleOverdraw(true); caps.SetToggleBatch(true); caps.SetToggleStrokeType(true); caps.SetTogglePause(true); caps.SetToggleWireframe(true); AMP::Server::GetInstance().SetAppControlCaps(&caps);
AMP client has the ability to display the name of the connected application in its status bar. This information is communicated by calling AMP::Server::GetInstance().SetConnectedApp. Also, the AMP client can display the current application state, but for this it needs to be informed whenever the application state changes. Use the following methods to update the state:
AMP can display special indicators, markers, on the CPU graph that correspond to C++ or ActionScript calls made within the profiled application. Add a marker in ActionScript as follows:
Amp.addMarker(1)
Note: Compiling .as files that contain the Amp.addMarker() code may produce a compilation error. To avoid this, make sure to use the intrinsic Amp class provided under the Resources/AS2/CLIK directory.
Add a marker in C++ as follows:
GFx::MovieImpl:: AdvanceStats->AddMarker(1)
AMP will then display a marker on the frame where the call was made. The integer argument will be used in the future to display more than one type of marker.