I tried to wrap the call to $p->ping($host) with some benchmarking by Time::HiRes.
For example,
Unfortunately, the times I got back were not consistent with the ping user call:use Net::Ping; use Time::HiRes qw( usleep ualarm gettimeofday tv_interval ); my $p = new Net::Ping; my $t0 = [gettimeofday]; $p->ping('www.yahoo.com'); print "Elapsed time: ", tv_interval ( $t0, [gettimeofday]), "\n";
It doesn't appear in the perldocs of Net::Ping that it is sending multiple packets, so I'm somewhat mystified where the time difference comes in.[bogus@www bin]$ ping -c 1 www.yahoo.com PING www.yahoo.akadns.net (216.32.74.50) from 216.90.131.2 : 56(84) by +tes of data. 64 bytes from www1.dcx.yahoo.com (216.32.74.50): icmp_seq=0 ttl=242 ti +me=290.891 msec --- www.yahoo.akadns.net ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max/mdev = 290.891/290.891/290.891/0.000 ms [bogus@www bin]$ ./ping-test.pl Elapsed time: 5.04157 [bogus@www bin]$ ping -c 1 www.yahoo.com PING www.yahoo.akadns.net (216.32.74.52) from 216.90.131.2 : 56(84) by +tes of data. 64 bytes from www3.dcx.yahoo.com (216.32.74.52): icmp_seq=0 ttl=242 ti +me=94.607 msec --- www.yahoo.akadns.net ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max/mdev = 94.607/94.607/94.607/0.000 ms [olsonco@www bin]$ ./ping-test.pl Elapsed time: 5.037361 [bogus@www bin]$ ping -c 1 www.yahoo.com PING www.yahoo.akadns.net (64.58.76.178) from 216.90.131.2 : 56(84) by +tes of data. 64 bytes from www9.dcx.yahoo.com (64.58.76.178): icmp_seq=0 ttl=242 ti +me=101.953 msec --- www.yahoo.akadns.net ping statistics --- 1 packets transmitted, 1 packets received, 0% packet loss round-trip min/avg/max/mdev = 101.953/101.953/101.953/0.000 ms [bogus@www bin]$
2001-04-19 Edit by Corion : Added CODE tags
In reply to Re: Net::Ping -- other output formats?
by Starky
in thread Net::Ping -- other output formats?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |