jablonka.czprosek.czf

czfcentos

Subversion Repositories:
[/] [trunk/] [router/] [home/] [www/] [cgi-bin/] [bander.cgi] - Blame information for rev 3

 

Line No. Rev Author Line
12czfcentos#!/usr/bin/perl
2#
3# Adam Pribyl, covex@ahoj.fsik.cvut.cz
4# Petr Simandl, www.simandl.cz
5 
6 
7print "Content-type: text/html\n\n";
8 
9print "<HTML><HEAD><META HTTP-EQUIV=Pragma CONTENT=no-cache></HEAD><BODY>\n";
10 
11#nocache!
12 
13 
14$kb = 1024;
15$nkba = 20; # size of a transfer test file
16$nkbb = 50; # size of b transfer test file
17$nkbc = 100; # size of c transfer test file
18$nkbd = 300; # size of d transfer test file
19$nkbe = 500; # size of e transfer test file
20 
21$svrtimeout = 30; # httpd server timeout in seconds
22 
23$testtime = 10; #maximum test time
24 
25$lospd = $nkba/$svrtimeout;
26 
27print "<center>\nIf no speed information is given then either your connection is too slow (< $lospd kiB/s) or you are experiencing signal dropouts. <br>\n";
28 
29print "Sending";
30 
31$tm1 = time;
32 
33for ($f = 1; $f <= $nkba; $f++) {
34 print "<!--";
35 for ($g = 1; $g <= ($kb/2-9) ; $g++) { print "aa"; }
36 print "-->. ";
37}
38$tm2 = time;
39$nkb = $nkba;
40print "$nkb";
41print "kiB";
42 
43if ( ($tm2-$tm1) < $testtime )
44{
45for ($f = 1; $f <= $nkbb; $f++) {
46 print "<!--";
47 for ($g = 1; $g <= ($kb/2-9) ; $g++) { print "bb"; }
48 print "-->. ";
49}
50$tm2 = time;
51$nkb = $nkb + $nkbb;
52print "$nkb";
53print "kiB";
54}
55 
56if ( ($tm2-$tm1) < $testtime )
57{
58for ($f = 1; $f <= $nkbc; $f++) {
59 print "<!--";
60 for ($g = 1; $g <= ($kb/2-9) ; $g++) { print "cc"; }
61 print "-->. ";
62}
63$tm2 = time;
64$nkb = $nkb + $nkbc;
65print "$nkb";
66print "kiB";
67}
68 
69if ( ($tm2-$tm1) < $testtime )
70{
71for ($f = 1; $f <= $nkbd; $f++) {
72 print "<!--";
73 for ($g = 1; $g <= ($kb/2-9) ; $g++) { print "dd"; }
74 print "-->. ";
75}
76$tm2 = time;
77$nkb = $nkb + $nkbd;
78print "$nkb";
79print "kiB";
80}
81 
82if ( ($tm2-$tm1) < $testtime )
83{
84for ($f = 1; $f <= $nkbe; $f++) {
85 print "<!--";
86 for ($g = 1; $g <= ($kb/2-9) ; $g++) { print "ee"; }
87 print "-->. ";
88}
89$tm2 = time;
90$nkb = $nkb + $nkbe;
91print "$nkb";
92print "kiB";
93}
94 
95print "<br>\n";
96 
97$adresa = "$ENV{'REMOTE_ADDR'}";
98$server = "$ENV{'SERVER_NAME'}";
99 
100print "\n<P>";
101$time = ($tm2-$tm1);
102printf "Sent $nkb kiB from $server to $adresa in $time seconds<br>\n";
103print "Approximate download bandwidth speed of your connection is: ";
104#to not divide accidentaly by zero we accept inacurrancy of 0.001s
105$speed = $nkb*$kb/($tm2-$tm1+0.001);
106$speedkb = $speed/$kb;
107$speedkbps = 8*$speed/$kb;
108printf "%.2f B/s = %.2f kiB/s = %.2f kib/s\n", $speed, $speedkb, $speedkbps;
109$date = `date`;
110print "<BR>$date\n<BR>";
111print "<A HREF=\"http://bbs.cvut.cz/~covex/czfree/index.html\#bander\">Bander speed test</A>\n";
112 
113print "</center></BODY></HTML>";

Powered by WebSVN 2.2.1