Zaloguj | Zarejestruj | FAQ
Anonymous

Webpage redirection time

+ Odpowiedz

Posty: 5 Strona 1 z 1


Webpage redirection time

przez AbhijeetM » So gru 01, 2012 5:33 pm

Hi all,

I want to calculate time consumed in redirecting from 1 webpage to another webpage.
For Example:
1) I am using Facebook in Google Chrome browser.
I have shared 1 link on my Facebook profile like below:

http://www.webdeveloper.com/

2) When I click on this link from my Facebook profile, then this website will open in new tab.

3) I want to calculate time difference in miliseconds or microseconds between below two events:
First Event: Time of clicking link "http://www.webdeveloper.com/" from my Facebook profile.
Second Event: Time of completely loading webpage of "http://www.webdeveloper.com/".

Thank you in advance.
Avatar użytkownika

AbhijeetM

  • Posty: 3
  • Dołączył(a): So gru 01, 2012 5:31 pm

Re: Webpage redirection time

przez phpsingh » N gru 02, 2012 6:09 am

<?php
//Page process time
calculation
/*
The microtime() function
fetches the current current
Unix timestamp with
microseconds
another alternative method is
to use the microtime() so that
it returns a float value
$time=microtime(1);
this will return the current
Unix timestamp like this
1113928831.585405
*/
//record the starting time
$start=microtime();
$start=explode(" ",$start);
$start=$start[1]+$start[0];
sleep(2);//halt the script for 2
seconds
//I put this just to affect the
final page process time
output...u will have your code
here..
//record the ending time
$end=microtime();
$end=explode(" ",$end);
$end=$end[1]+$end[0];
printf("Page was generated by
PHP %s in %f
seconds",phpversion(),$end-$
start);
//sample output: Page was
generated by PHP 5.0.3 in
1.987188 seconds
?>
Avatar użytkownika

phpsingh

  • Posty: 29
  • Dołączył(a): Pt lis 09, 2012 6:08 am
--
My Passion Is Only Learning Nothing Else :)

Re: Webpage redirection time

przez AbhijeetM » N gru 02, 2012 8:25 am

Thank you for your response. But this is not what I want.
I want to measure time different between 2 events. Can you add the code for it by replacing the line of "sleep(2)" ?
The time difference is to be calculated in navigating from 1 domain(not only facebook, but any domain) to another domain.



phpsingh napisał(a):<?php
//Page process time
calculation
/*
The microtime() function
fetches the current current
Unix timestamp with
microseconds
another alternative method is
to use the microtime() so that
it returns a float value
$time=microtime(1);
this will return the current
Unix timestamp like this
1113928831.585405
*/
//record the starting time
$start=microtime();
$start=explode(" ",$start);
$start=$start[1]+$start[0];
sleep(2);//halt the script for 2
seconds
//I put this just to affect the
final page process time
output...u will have your code
here..
//record the ending time
$end=microtime();
$end=explode(" ",$end);
$end=$end[1]+$end[0];
printf("Page was generated by
PHP %s in %f
seconds",phpversion(),$end-$
start);
//sample output: Page was
generated by PHP 5.0.3 in
1.987188 seconds
?>
Avatar użytkownika

AbhijeetM

  • Posty: 3
  • Dołączył(a): So gru 01, 2012 5:31 pm

Re: Webpage redirection time

przez XainPro » Pn gru 03, 2012 8:54 am

use firefox
and this addon will help you to know loading time of any webpage :)
https://addons.mozilla.org/en-us/firefo ... statusbar/
Avatar użytkownika

XainPro

  • Posty: 3933
  • Dołączył(a): Pt lut 17, 2012 8:10 pm

Re: Webpage redirection time

przez AbhijeetM » Wt gru 04, 2012 9:48 am

Thank you for your responses.
I decided to go ahead with firebug for Firefox and Developer Tools for Chrome.
My problem is solved.
Avatar użytkownika

AbhijeetM

  • Posty: 3
  • Dołączył(a): So gru 01, 2012 5:31 pm


+ Odpowiedz

Strona 1 z 1