ushtabalakh
Programmer
- Jun 4, 2007
- 132
Hi, I have made the following functions
To measure how much time it takes for apache to execute my codes, but it doesn't work properly, can someone tell me why?
This is the output:
step 1 took 1207904003.4 seconds.
step 2 took 1207904003.41 seconds.
step 3 took 1207904003.52 seconds.
step 4 took 1207904003.53 seconds.
step 5 took 1207904003.55 seconds.
Thanks
To measure how much time it takes for apache to execute my codes, but it doesn't work properly, can someone tell me why?
Code:
<?php
$starttime = microtime(true);
usleep(100);
$starttime = ShowTime($startTime, "step 1");
usleep(400);
$starttime = ShowTime($startTime, "step 2");
usleep(500);
$starttime = ShowTime($startTime, "step 3");
usleep(600);
$starttime = ShowTime($startTime, "step 4");
usleep(700);
$starttime = ShowTime($startTime, "step 5");
function ShowTime($startTime, $Message)
{
$time_end = microtime(true);
$time = $time_end - $time_start;
echo $Message . " took " . $time . " seconds.<br/>";
return microtime(true);
}
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
?>
This is the output:
step 1 took 1207904003.4 seconds.
step 2 took 1207904003.41 seconds.
step 3 took 1207904003.52 seconds.
step 4 took 1207904003.53 seconds.
step 5 took 1207904003.55 seconds.
Thanks