Sunday, February 6, 2011

Elastic Racetrack tool

In one of my previous posts I showed tool that can measure actual frame per second of your applications. I noticed that some times it is not enough to analyze performance of application, so I decided to create more sophisticated tool. Often flash player's cycle Adobe displays as "Ellastic Racetrack" (see http://www.craftymind.com/2008/04/18/updated-elastic-racetrack-for-flash-9-and-avm2/). I wrote tool that can visually show that racetrack on the screen. It gathers information of code execution and rendering times during some interval (configurable, by default 1 sec.) and draws on the screen two racetracks that represents heaviest code execution frame and heaviest rendering  frame.



Press "Execute code" button to slow down performance and see how racetrack react. Use view source to get source code.
To start using it you need to include swc file into project and just put ElasticRacetrack component on the stage. Also, you can download source code of lib here.

3 comments:

  1. addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);

    should be replaced with

    addEventListener(FlexEvent.CREATION_COMPLETE, addedToStageHandler);

    because addedToStageHandler is called before createChildren and causes null reference on timer.start().

    ReplyDelete
  2. RENDER_FRAME event can be skiped on some frames. EXIT_FRAME event can be used to measure code execution time instead of assigning default 33ms (time between two ENTER_FRAME events ) to code execution time in this case.
    It also should be noted that there is no way to pricisely measure if rendering time is lower then (33ms - codeExecutionTime).

    ReplyDelete
    Replies
    1. The project is open source and hosting page is here http://code.google.com/p/elastic-racetrack/. I would highly appreciate you if you can improve project. just send me name and I will add you as committer into project

      Delete