banderdyn |
Subversion Repositories: |
Rev 1 | Rev 2 | |
---|---|---|
Line 13... | Line 13... | |
# http://www.perldoc.com/perl5.8.0/pod/perlfaq8.html |
# http://www.perldoc.com/perl5.8.0/pod/perlfaq8.html | |
# |
# | |
# Bander, maintenance: Adam Pribyl, covex@ahoj.fsik.cvut.cz |
# Bander, maintenance: Adam Pribyl, covex@ahoj.fsik.cvut.cz | |
# Dyn: Petr Simandl, www.simandl.cz |
# Dyn: Petr Simandl, www.simandl.cz | |
############################################### |
############################################### | |
| ||
use Time::HiRes; | ||
|
| |
print "Content-type: text/html\n\n"; |
print "Content-type: text/html\n\n"; | |
|
| |
print "<HTML><HEAD><META HTTP-EQUIV=Pragma CONTENT=no-cache></HEAD><BODY>\n"; # nocache! |
print "<HTML><HEAD><META HTTP-EQUIV=Pragma CONTENT=no-cache>"; | |
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></HEAD><BODY>\n"; # nocache! | ||
|
| |
$kb = 1024; |
$kb = 50*1024; | |
@nkbp = (10,20,70,150,300,218); |
@nkbp = (10,20,70,100,300,500); | |
$nkb = 0; |
$nkb = 0; | |
$lnkbp = $#nkbp; |
$lnkbp = $#nkbp; | |
|
| |
@pism = ("aa","bb","cc","dd","ee","ff"); |
@pism = ("aaaaaaaaaa","bbbbbbbbbb","cccccccccc","dddddddddd","eeeeeeeeee","ffffffffff"); | |
|
| |
$svrtimeout = 30; # httpd server timeout in seconds |
$svrtimeout = 30; # httpd server timeout in seconds | |
|
| |
$testtime = 10; # maximum test time |
$testtime = 10; # maximum test time | |
|
| |
$lospd = $nkbp[0]/$svrtimeout; |
$lospd = $nkbp[0]/$svrtimeout; | |
|
| |
#print "<CENTER>\n"; |
print "<CENTER>\n"; | |
printf "If no speed information is given then either your connection is too slow (< %1.2f kiB/s) or you are experiencing signal dropouts. <br>\n", $lospd; |
printf "Pokud se VĂĄm po chvilce nezobrazĂ namÄĹenĂĄ rychlost, tak mĂĄte pomalĂŠ pĹipojenĂ (< %1.2f kiB/s) a nebo zaruĹĄenĂŠ pĹipojenĂ. <br>\n", $lospd; | |
|
| |
print "Sending"; |
print "OdeslĂĄno"; | |
|
| |
|
$tm2 = 0; | |
$tm2 = $tm1 = time; |
$tm1 = [ Time::HiRes::gettimeofday( ) ]; | |
|
| |
for ($ii = 0; $ii <= $lnkbp; $ii++) { |
for ($ii = 0; $ii <= $lnkbp; $ii++) { | |
if ( ($tm2-$tm1) < $testtime ) |
if ( $tm2 < $testtime ) | |
{ |
{ | |
for ($f = 1; $f <= $nkbp[$ii]; $f++) { |
$numkb=$nkbp[$ii]; | |
for ($f = 1; $f <= $numkb; $f++) { | ||
print "<!--"; |
print "<!--"; | |
for ($g = 1; $g <= ($kb/2-5) ; $g++) { print "$pism[$ii]"; } |
for ($g = 1; $g <= (($kb-10)/50) ; $g++) { print "aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeee"; } | |
print "-->. \n"; |
print "-->. \n"; | |
} |
} | |
$tm2 = time; |
$tm2 = Time::HiRes::tv_interval( $tm1 ); | |
$nkb = $nkb + $nkbp[$ii]; |
$nkb = $nkb + $nkbp[$ii]; | |
print "$nkb"."kiB"; |
printf "%.2f MiB", $nkb * $kb/1000000; | |
} |
} | |
} |
} | |
|
| |
print "<br>\n"; |
print "<br>\n"; | |
|
| |
$adresa = "$ENV{'REMOTE_ADDR'}"; |
$adresa = "$ENV{'REMOTE_ADDR'}"; | |
$server = "$ENV{'SERVER_NAME'}"; |
$server = "$ENV{'SERVER_NAME'}"; | |
|
| |
print "\n<P>"; |
print "\n<P>"; | |
$time = ($tm2-$tm1); |
$time = ($tm2); | |
printf "Sent $nkb kiB from $server to $adresa in $time seconds<br>\n"; |
$numMb = $nkb * $kb/1000024; | |
print "Approximate download bandwidth speed of your connection is: "; |
printf "OdeslĂĄno %.2f MiB ze serveru $server na IP adresu $adresa za %.2f sekund<br />\n", $numMb, $time; | |
# to not divide accidentaly by zero we accept inacurrancy of 0.001s |
print "PĹibliĹžnĂĄ rychlost stahovĂĄnĂ VaĹĄeho pĹipojenĂ je: "; | |
$speed = $nkb*$kb/($time+0.001); |
$speed = $nkb*$kb/$tm2; | |
$speedkb = $speed/$kb; |
$speedkb = $speed/1024; | |
$speedkbps = 8*$speed/$kb; |
$speedkbps = 8*$speed/1024; | |
printf "%.2f B/s = %.2f kiB/s = %.2f kib/s\n", $speed, $speedkb, $speedkbps; |
printf "%.2f B/s = %.2f kiB/s = %.2f Mib/s\n", $speed, $speedkb, $speedkbps/1000; | |
$date = `date`; |
||
print "<BR>$date\n<BR>"; |
||
print "<A HREF=\"http://bbs.cvut.cz/~covex/czfree/index.html\#bander\">BanderDyn speed test</A>\n"; |
||
|
| |
#print "</CENTER>\n"; |
printf "<h3>VaĹĄe rychlost stahovĂĄnĂ ze serveru $server je %.2f MegabitĹŻ za sekundu</h3>\n", $speedkbps/1000; | |
print "</BODY></HTML>"; |
$date = `date`; | |
print "$date\n<BR />"; | ||
print "<A HREF=\"http://bbs.cvut.cz/~covex/czfree/index.html\#bander\">Bander speed test</A>\n"; | ||
|
| |
print "</center></BODY></HTML>"; |