Jump to content

[SOLVED] page load time show really high but not


shocker-z

Recommended Posts

Hi,

 

just a quick one im running PHP 5.2 on IIS 6 (Windows 2003 Server) and im getting a weird load time result when trying to display page load times on each page.

 

e.g.

Page generated in 1193387528.5501 seconds.

 

this is my current code

<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
echo '<p>Page generated in '.$total_time.' seconds.</p>'."\n";
?>

 

but i've tried 4 others which are all simular. Any idea as to why it's showing a false result as it's loading in unde 1 second (Dual Xeon 2.8 HT server and connecting over 100mb pipe (college campus))

 

 

Regards

Liam

You havent got the second microtime.

 

Try this.

$time = microtime();

$time = explode(" ", $time);

$time = $time[1] + $time[0];

$start = $time;

 

content your testing

 

$time = microtime();

$time = explode(" ", $time);

$time = $time[1] + $time[0];

$finish = $time;

$totaltime = ($finish - $start);

printf ("Page took %f seconds to load.", $totaltime);

Try this.

$time = microtime();

$time = explode(" ", $time);

$time = $time[1] + $time[0];

$start = $time;

 

content your testing

 

$time = microtime();

$time = explode(" ", $time);

$time = $time[1] + $time[0];

$finish = $time;

$totaltime = ($finish - $start);

printf ("Page took %f seconds to load.", $totaltime);

 

 

worked great.. i realised as i went down the page of a site i copied the bottom code but not the top..

 

My fault :)

 

Thanks alot :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.