Off-Topic
Dan Stromberg
strombrg at dcs.nac.uci.edu
Thu Sep 16 18:24:43 CEST 2004
On Thu, 2004-09-16 at 06:31, Don {KMTS}.Net Support wrote:
> Hi list,
> I am sorry to ask this off topic question, but I am trying to locate a
> Linux/Unix based program (preferably ftp so there is no caching) to do speed
> tests on. We are an ISP of 4000 and we have been relying on licensing the
> "speed test" page, but as that uses http we feel the numbers are not correct
> for our customers. Are there any open source speed test sources that I can
> install on a Linux machine that my customers can go to to check their
> speeds?
> Any help in this matter are much appreciated.
iperf is good.
ftp is good.
I often use the attached program, named reblock. It can be inserted
into a pipeline based on rsh, ssh, netcat or whatever, and slows down
the pipeline only marginally (especially if you use a large blocksize).
The -t option is what gives the throughput measure.
--
Dan Stromberg DCS/NACS/UCI <strombrg at dcs.nac.uci.edu>
-------------- next part --------------
#!/dcs/bin/python
import select
import sys
import string
import os
def main():
verbose = 0
tp = 0
#sys.stderr.write(sys.argv[1]+'\n')
if sys.argv[1:] and sys.argv[1] == '-t':
del sys.argv[1]
# thruput option
tp = 1
import time
size = 0
t0 = time.time()
if sys.argv[1:]:
blocksize=string.atoi(sys.argv[1])
timeout=string.atof(sys.argv[2])
else:
sys.stderr.write('usage: '+sys.argv[0]+' [-t] blocksize timeout\n')
sys.stderr.write('-t reports on throughput\n')
sys.stderr.write('blocksize is in bytes\n')
sys.stderr.write('timeout is in seconds (floating point)\n')
sys.exit(0)
bigblock=''
#sys.stderr.write(str(tp)+'\n')
while 1:
retval=select.select([0],[],[],timeout)
if len(retval[0]) == 0:
# timeout
if verbose:
sys.stderr.write('got timeout\n')
finish(blocksize,bigblock,tp)
break
elif len(retval[0]) == 1 and retval[0][0] == 0:
# got input
if verbose:
sys.stderr.write('select says ready to read\n')
block = os.read(0,blocksize)
if not block:
# eof
if verbose:
sys.stderr.write('got eof\n')
finish(blocksize,bigblock,tp)
break
if len(block) < blocksize and verbose:
sys.stderr.write('got short block\n')
bigblock=bigblock+block
if len(bigblock) >= blocksize:
os.write(1,bigblock[0:blocksize])
if tp:
size = size + blocksize
dt = time.time() - t0
sys.stderr.write('Kbytes: '+str(int(size/1024))+\
'\tKbps: '+\
str(int((size / (dt)) / 1024))+\
'\tmin: '+str(int(dt/60))+' \r')
bigblock=bigblock[blocksize:]
else:
sys.stderr.write('Something bizarre happened\n')
sys.stderr.write(str(retval)+'\n')
def finish(blocksize,block,tp):
# write what's left, and pad to an integral block size
if len(block) > blocksize:
sys.stderr.write('internal error: len(block) > blocksize\n')
sys.exit(1)
remainder = blocksize - len(block)
os.write(1,block+ (chr(0) * remainder))
if tp:
sys.stderr.write('\n')
main()
sys.exit(0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://www.monitoring-lists.org/archive/users/attachments/20040916/851ba2d0/attachment.sig>
More information about the Users
mailing list