#!/usr/bin/perl # ############################################## # BanderDyn ############################################## # Simple script for measuring download # speed, with some dynamical ability # to end up as soon as 10s are crossed. # # It's time precision is 1s - # we only relay on system time ability # and are not using require 'sys/syscall.ph'; # http://www.perldoc.com/perl5.8.0/pod/perlfaq8.html # # Bander, maintenance: Adam Pribyl, covex@ahoj.fsik.cvut.cz # Dyn: Petr Simandl, www.simandl.cz ############################################### print "Content-type: text/html\n\n"; print "\n"; # nocache! $kb = 1024; @nkbp = (10,20,70,150,300,218); $nkb = 0; $lnkbp = $#nkbp; @pism = ("aa","bb","cc","dd","ee","ff"); $svrtimeout = 30; # httpd server timeout in seconds $testtime = 10; # maximum test time $lospd = $nkbp[0]/$svrtimeout; #print "
\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.
\n", $lospd; print "Sending"; $tm2 = $tm1 = time; for ($ii = 0; $ii <= $lnkbp; $ii++) { if ( ($tm2-$tm1) < $testtime ) { for ($f = 1; $f <= $nkbp[$ii]; $f++) { print ". \n"; } $tm2 = time; $nkb = $nkb + $nkbp[$ii]; print "$nkb"."kiB"; } } print "
\n"; $adresa = "$ENV{'REMOTE_ADDR'}"; $server = "$ENV{'SERVER_NAME'}"; print "\n

"; $time = ($tm2-$tm1); printf "Sent $nkb kiB from $server to $adresa in $time seconds
\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/($time+0.001); $speedkb = $speed/$kb; $speedkbps = 8*$speed/$kb; printf "%.2f B/s = %.2f kiB/s = %.2f kib/s\n", $speed, $speedkb, $speedkbps; $date = `date`; print "
$date\n
"; print "BanderDyn speed test\n"; #print "

\n"; print ""; WebSVN - banderdyn - Blame - Rev 1 - /banderdyn.cgi
  jablonka.czprosek.czf

banderdyn

Subversion Repositories:
[/] [banderdyn.cgi] - Blame information for rev 1

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1