Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6325113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:50:01+00:00 2026-05-24T16:50:01+00:00

Is there a way to measure the average time it takes my code to

  • 0

Is there a way to measure the average time it takes my code to run and each frame to render for my Flex app? More specifically, I know how to use getTimer() but I’m not sure about which events I should listen to in order to do this. I was reading this post and am not sure how you’d figure out how long the actual rendering took (it would seem like it may be the time between the RENDER event fires and the next ENTER_FRAME event fires, but I’m not sure). Also, not exactly sure where the user code happens, or whether I should care about EXIT_FRAME and FRAME_CONSTRUCTED.

Any help much appreciated!

EDIT —-

here’s a snippet of code showing the main events for each repetition of the second frame in a super simple flex app. What I’m trying to figure out is whether there is a clear relationship between the “user code” and “rendering” parts of the classic Flex racetrack and the intervals between the four main signals that I’m tracing from.

The code:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

    <fx:Script>
        <![CDATA[
            import flash.utils.getTimer;

            public var t:Timer;
            protected function button1_clickHandler(event:MouseEvent):void
            {
                t = new Timer(40, 50);
                t.addEventListener(TimerEvent.TIMER, handleTimeTick);
                t.addEventListener(TimerEvent.TIMER_COMPLETE, timerDone);
                addEventListener(Event.RENDER, application1_renderHandler);
                addEventListener(Event.ENTER_FRAME, application1_enterFrameHandler);
                addEventListener(Event.EXIT_FRAME, application1_exitFrameHandler);
                addEventListener(Event.FRAME_CONSTRUCTED, application1_frameConstructedHandler);
                t.start();
            }

            protected function handleTimeTick(e:TimerEvent):void
            {
                shape.x += 5;
            }

            protected function timerDone(e:TimerEvent):void
            {
                t.stop();
                t.removeEventListener(TimerEvent.TIMER, handleTimeTick);
                t.removeEventListener(TimerEvent.TIMER_COMPLETE, timerDone);
                removeEventListener(Event.RENDER, application1_renderHandler);
                removeEventListener(Event.ENTER_FRAME, application1_enterFrameHandler);
                removeEventListener(Event.EXIT_FRAME, application1_exitFrameHandler);
                removeEventListener(Event.FRAME_CONSTRUCTED, application1_frameConstructedHandler);
            }

            protected function application1_renderHandler(event:Event):void
            {
                trace("render fire", getTimer());
            }

            protected function application1_enterFrameHandler(event:Event):void
            {
                trace("enter frame fire", getTimer());
            }

            protected function application1_exitFrameHandler(event:Event):void
            {
                trace("exit frame fire", getTimer());
            }

            protected function application1_frameConstructedHandler(event:Event):void
            {
                trace("frame constructed fire", getTimer());
            }

        ]]>
    </fx:Script>


    <s:Rect id="shape" x="0" y="0" height="20" width="20">
        <s:fill>
            <s:SolidColor color="0xff0000"/>
        </s:fill>
    </s:Rect>

    <s:Button x="10" y="100" click="button1_clickHandler(event)" label="go"/>
</s:Application>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:50:02+00:00Added an answer on May 24, 2026 at 4:50 pm

    Ok, after reading plenty around the web I think this presentation gives the best info about how to measure elastic race track times (see for instance this piece of code from the presentation).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using only ANSI C, is there any way to measure time with milliseconds precision
is there any nice GNU way how to measure average (worst case, best case)
Is there way in next piece of code to only get the first record?
Is there a way to measure the the amount of a string that will
is there way thats i can preselect an item when the page loads or
Is there a way to enforce constraint checking in MSSQL only when inserting new
Is there any way to check whether a file is locked without using a
Is there a way to find the name of the program that is running
Is there a way to hide radio buttons inside a RadioButtonList control programmatically?
Is there a way to find the number of files of a specific type

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.