2

We have Flex/Java app with a typical scenario:

  1. Clicking the button
  2. Preparing request
  3. Sending request to the backend
  4. Receiving a response from the backend
  5. Rendering the response

How can I measure time from the start of step 1 to end of step 5?

dzieciou
  • 4,049
  • 8
  • 41
  • 85

1 Answers1

3

The most common approach would be to use the getTimer() method. Call it when you click the button; and call it again when you finish rendering the response. Compare the two values to get the amount of time that has passed.

JeffryHouser
  • 39,401
  • 4
  • 38
  • 59
  • I was expecting complex answer, but the simplest one is the most efficient. Just one problem: What if I test compiled application and do not have access to sources (or do want to access them)? – dzieciou Sep 19 '11 at 22:37
  • You could always save the display the rendered time on the screen or store it on the server in some manner to review while not in "Debug" mode. What resources don't you have access to from the compiled app? – JeffryHouser Sep 19 '11 at 22:42
  • But how can I know when the rendering finished? What kind of event I've need to catch? – dzieciou Sep 23 '11 at 07:49
  • In a Flex Component, you can use the updateComplete event to tell when a component has finished it's rendering cycle. – JeffryHouser Sep 23 '11 at 12:33