29, August 2008

Check how many time takes your page to load - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Check how many time takes your page to load
« previous next »
Pages: [1] Print

Author Topic: Check how many time takes your page to load  (Read 587 times)
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8027
41119 credits
Members referred : 3



« on: Oct 04, 2005, 07:42:06 PM »

I know it is too easy, and actually I got this code from the php.net site, but it is very usefull.

You should put two pieces of code in your page, one in the top and one in the bottom.

Here is the top part :

Code:
<?php
function getmicrotime(){
   list(
$usec$sec) = explode(" ",microtime());
   return ((float)
$usec + (float)$sec);
   }

$time_start getmicrotime();
?>


After that put whatever your pages do, and in the end add this :

Code:
<?php
$time_end 
getmicrotime();
$time $time_end $time_start;
?>


Now the $time variable stores the time that your page loaded.

So you can also put something like that :

Code:
<?php
 
echo "Page loaded in " round$time minutes6) ." minutes"
?>


Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
I wish I was an Oscar winner
**
Posts: 86
247 credits
Members referred : 0



« Reply #1 on: Oct 05, 2005, 09:33:23 PM »

You are right, easy but yet very effective, especcialy for those who want to track every aspect of their website.
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1523
6847 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #2 on: Oct 12, 2005, 04:42:57 AM »

I have this on cetain pages, mostly pages with search forms  or complicated code in it, and what I do is check how long the page takes to search for something. If it takes more than a certain time then I know that the SQL is unefficient and needs tweaking or the page needs to be changed. If it goes over the set time, the page emails me with all the info and time taken.


Last blog : Site of the Month - August 2007
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8027
41119 credits
Members referred : 3



« Reply #3 on: Oct 12, 2005, 02:19:01 PM »

That's a very good practice wineo. I do something simmilar to know how my caching system works (on the directory)

The only difference is that I store these results in a mysql database, so I am able to know the impact of every update in the site.

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=503
Tags : php mysql databases Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Check how many time takes your page to load
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Aug 29, 2008, 09:41:33 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 36.173
Total Topics: 7.460
Total Members: 3.859
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: naeemuddin

46 Guests, 5 Users online :

16 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.