Bug #18013 [Com]: Time to ping
| From: | pacmanbg | Date: | Thu, 19 Apr 2012 14:33:28 +0000 |
| Subject: | Bug #18013 [Com]: Time to ping | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-8560@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=18013&edit=1
ID: 18013
Comment by: pacmanbg
Reported By: pacman at abv dot bg
Summary: Time to ping
Status: Open
Type: Bug
Package: Net_Ping
Operating System: 2.6.18-194.11.3.el5
Package Version: 2.4.5
PHP Version: 5.1.6
New Comment:
Actually this is not a bug. The effect comes from default behavior of
the ping command, which by default waits 1 second between pings.
but there can be added additional argument in Net_Ping "interval" which
will be used to set "-i" parameter to the linux ping command.
Previous Comments:
------------------------------------------------------------------------
[2010-10-29 16:58:41] toobulkeh
Description:
------------
a count of > 1 returns horrible Ping times. For example a count
of 1 returns a page generated time of 0.023s for 4 IP addresses
while a count of 2 returns ~ 4 seconds for the same IP addresses
(A 200x increase in time, not 2x increase).
Timeout doesn't appear to have an effect on it either.
Test script:
---------------
$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$start = $time;
$ping = Net_Ping::factory();
if (PEAR::isError($ping)) {
echo $ping->getMessage();
} else {
$ping->setArgs(array('count' => 2, 'timeout' => 1));
$pingResult = $ping->ping("localhost");
}
$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$finish = $time;
$totaltime = ($finish - $start);
echo "Page generated in ".$totaltime."s<br>";
Expected result:
----------------
You should get a time generated of ~ 0.01s for the above script
Actual result:
--------------
You actually get a time generated of ~ 1s for the script.
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18013&edit=1