Ajax is 'asynchrounous', meaning you can have many calls at the same
time, meaning you would require multiple start/end time to get what
you want. I could tell you how in a few paragraphs, but the short
answer is much better and way simpler;

1. Get Firefox
2. Get Firebug (and addon to firefox)

the process is easy; visit your page using firefox, click the profile
button in firebug, then do whatever ajax call, script operation,...
you want, and finally click profile again.

You will see information avour the scripts run, how long it took, what
(ajax) calls were made, and how long it took for the response to come
back.

I've been using that Profiler for a while.. and I'd doubt you'd need a
custom profiler! ;)

Hope this help!

Seb.

On Mar 28, 2:01 pm, "skyblueink" <[EMAIL PROTECTED]> wrote:
> Next snippet is supposed to show 10 <div>s, each displays the loading
> time. Loading time is the difference between endTime and startTime:
> startTime and endTime was given by javascript Date.getTime method at
> the time of 'loading' and 'complete' for each run of $i. But the
> calculated time is always 0, that is startTime and endTime are always
> the same values in the php for loop.
> I'm a newbie programmer and this might be a silly question, but I'd
> really like to know how to get load time in VakePHP AJAX operation.
> The action url '/test/content/?i=$i' usually takes 5 seconds for
> loading, but it is not reflected in the loadTime below.
>
> <script type="text/javascript">
> var now = new Date();
> </script>
>
> <?php
> for ($i = 0; $i < 10; $i++){
>      $view = 'view' . $i;
>      echo "<div id=$view></div>";
>
> $options = array(
>      'update'   => "$view",
>      'url'      => "/test/content/?i=$i",
>      'type'     => 'asynchronous',
>      'loading'  => "Element.hide($view);startTime=now.getTime();",
>      'complete' =>
> "Effect.Appear($view);endTime=now.getTime();loadTime=endTime-
> startTime;Element.update('$view','$i'+':'+loadTime);"
>  );
>
> echo 
> $javascript->event('window','load',$ajax->remoteFunction($options),false);
> }
>
> ?>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to