Change how we build out info from config data
This commit is contained in:
parent
713860a4b4
commit
d1b1185bfc
|
@ -621,24 +621,41 @@ class Speedtest(object):
|
||||||
|
|
||||||
ignore_servers = map(int, server_config['ignoreids'].split(','))
|
ignore_servers = map(int, server_config['ignoreids'].split(','))
|
||||||
|
|
||||||
sizes = dict(upload=[], download=[])
|
# sizes = dict(upload=[], download=[])
|
||||||
for desc, size in times.items():
|
# sizes = {}
|
||||||
if desc.startswith('ul'):
|
# for desc, size in times.items():
|
||||||
sizes['upload'].append(int(size))
|
# if desc.startswith('ul'):
|
||||||
elif desc.startswith('dl'):
|
# sizes['upload'].append(int(size))
|
||||||
sizes['download'].append(int(int(size) / 10000))
|
# elif desc.startswith('dl'):
|
||||||
|
# sizes['download'].append(int(int(size) / 10000))
|
||||||
|
ratio = int(upload['ratio'])
|
||||||
|
upload_max = int(upload['maxchunkcount'])
|
||||||
|
up_sizes = [32768, 65536, 131072, 262144, 524288, 1048576, 7340032]
|
||||||
|
sizes = {
|
||||||
|
'upload': up_sizes[ratio - 1:],
|
||||||
|
'download': [350, 500, 750, 1000, 1500, 2000, 2500,
|
||||||
|
3000, 3500, 4000]
|
||||||
|
}
|
||||||
|
|
||||||
sizes['upload'].sort()
|
# sizes['upload'].sort()
|
||||||
sizes['download'].sort()
|
# sizes['download'].sort()
|
||||||
|
|
||||||
counts = dict(upload=int(upload['threadsperurl']),
|
counts = {
|
||||||
download=int(download['threadsperurl']))
|
# 'upload': int(upload['threadsperurl']),
|
||||||
|
'upload': int(upload_max * 2 / len(sizes['upload'])),
|
||||||
|
'download': int(download['threadsperurl'])
|
||||||
|
}
|
||||||
|
|
||||||
threads = dict(upload=int(upload['threads']),
|
threads = {
|
||||||
download=int(server_config['threadcount']))
|
'upload': int(upload['threads']),
|
||||||
|
# 'download': int(server_config['threadcount'])
|
||||||
|
'download': int(server_config['threadcount']) * 2
|
||||||
|
}
|
||||||
|
|
||||||
length = dict(upload=int(upload['testlength']),
|
length = {
|
||||||
download=int(download['testlength']))
|
'upload': int(upload['testlength']),
|
||||||
|
'download': int(download['testlength'])
|
||||||
|
}
|
||||||
|
|
||||||
self.config.update({
|
self.config.update({
|
||||||
'client': client,
|
'client': client,
|
||||||
|
@ -647,6 +664,7 @@ class Speedtest(object):
|
||||||
'counts': counts,
|
'counts': counts,
|
||||||
'threads': threads,
|
'threads': threads,
|
||||||
'length': length,
|
'length': length,
|
||||||
|
'upload_max': upload_max
|
||||||
})
|
})
|
||||||
|
|
||||||
self.lat_lon = (float(client['lat']), float(client['lon']))
|
self.lat_lon = (float(client['lat']), float(client['lon']))
|
||||||
|
@ -925,12 +943,14 @@ class Speedtest(object):
|
||||||
for _ in range(0, self.config['counts']['upload']):
|
for _ in range(0, self.config['counts']['upload']):
|
||||||
sizes.append(size)
|
sizes.append(size)
|
||||||
|
|
||||||
size_count = len(sizes)
|
# size_count = len(sizes)
|
||||||
|
size_count = self.config['upload_max']
|
||||||
|
|
||||||
start = timeit.default_timer()
|
start = timeit.default_timer()
|
||||||
|
|
||||||
def producer(q, sizes, size_count):
|
def producer(q, sizes, size_count):
|
||||||
for i, size in enumerate(sizes):
|
# for i, size in enumerate(sizes):
|
||||||
|
for i, size in enumerate(sizes[:size_count]):
|
||||||
thread = HTTPUploader(i, self.best['url'], start, size,
|
thread = HTTPUploader(i, self.best['url'], start, size,
|
||||||
self.config['length']['upload'])
|
self.config['length']['upload'])
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
Loading…
Reference in New Issue