#!/usr/bin/perl # # Adam Pribyl, covex@ahoj.fsik.cvut.cz # print "Content-type: text/html\n\n"; print "
\n"; #nocache! $tm1 = time; $kb = 1024; $nkb = 768; # size of transfer test file $svrtimeout = 30; # httpd server timeout in seconds $lospd = $nkb/$svrtimeout; print "If no speed information is given then either your connection is too slow (< $lospd kB/s) or you are experiencing signal dropouts. "; for ($f = 1; $f <= $nkb; $f++) { print ". "; } $tm2 = time; print "\n";
print "Approximate download bandwidth speed of your connection is: ";
#to not divide accidentaly by zero we accept inacurrancy of 0.001s
$speed = $nkb*$kb/($tm2-$tm1+0.001);
$speedkb = $speed/$kb;
$speedkbb = $speedkb*8;
printf "%.2f B/s = %.2f kB/s = %.2f kb/s\n", $speed, $speedkb, $speedkbb;
$date = `date`;
print "
$date\n
";
print "Bander speed test\n";
print "";