Added ms to average ping
This commit is contained in:
parent
9813cc3575
commit
f8e045996e
92
analyze.py
92
analyze.py
@ -1,46 +1,46 @@
|
||||
import csv
|
||||
|
||||
|
||||
def v1():
|
||||
column_timeouts = None
|
||||
column_count = 0
|
||||
column_counts = None
|
||||
column_sums = None
|
||||
|
||||
row_count = 0
|
||||
|
||||
with open('data/all.csv', 'r') as f:
|
||||
reader = csv.reader(f)
|
||||
|
||||
column_count = len(next(reader))
|
||||
f.seek(0)
|
||||
|
||||
column_timeouts = [0 for _ in range(column_count)]
|
||||
column_counts = [0 for _ in range(column_count)]
|
||||
column_sums = [0.0 for _ in range(column_count)]
|
||||
|
||||
for row in reader:
|
||||
row_count += 1
|
||||
for i, ping in enumerate(row):
|
||||
ping = float(ping)
|
||||
if ping == -1:
|
||||
column_timeouts[i] += 1
|
||||
else:
|
||||
column_counts[i] += 1
|
||||
column_sums[i] += ping
|
||||
|
||||
print(f'Rows: {row_count}')
|
||||
print(f'Columns: {column_count}')
|
||||
|
||||
for i in range(column_count):
|
||||
ctimeout = column_timeouts[i]
|
||||
ccounts = column_counts[i]
|
||||
csum = column_sums[i]
|
||||
|
||||
print(f'Column {i}')
|
||||
print(f'\tTimeouts: {round(ctimeout / row_count * 100, 2)}% ({ctimeout} of {row_count} requests)')
|
||||
print(f'\tAverage ping: {round(csum / ccounts, 4)}ms ({ccounts} of {row_count} requests)')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
v1()
|
||||
import csv
|
||||
|
||||
|
||||
def v1():
|
||||
column_timeouts = None
|
||||
column_count = 0
|
||||
column_counts = None
|
||||
column_sums = None
|
||||
|
||||
row_count = 0
|
||||
|
||||
with open('data/all.csv', 'r') as f:
|
||||
reader = csv.reader(f)
|
||||
|
||||
column_count = len(next(reader))
|
||||
f.seek(0)
|
||||
|
||||
column_timeouts = [0 for _ in range(column_count)]
|
||||
column_counts = [0 for _ in range(column_count)]
|
||||
column_sums = [0.0 for _ in range(column_count)]
|
||||
|
||||
for row in reader:
|
||||
row_count += 1
|
||||
for i, ping in enumerate(row):
|
||||
ping = float(ping)
|
||||
if ping == -1:
|
||||
column_timeouts[i] += 1
|
||||
else:
|
||||
column_counts[i] += 1
|
||||
column_sums[i] += ping
|
||||
|
||||
print(f'Rows: {row_count}')
|
||||
print(f'Columns: {column_count}')
|
||||
|
||||
for i in range(column_count):
|
||||
ctimeout = column_timeouts[i]
|
||||
ccounts = column_counts[i]
|
||||
csum = column_sums[i]
|
||||
|
||||
print(f'Column {i}')
|
||||
print(f'\tTimeouts: {round(ctimeout / row_count * 100, 2)}% ({ctimeout} of {row_count} requests)')
|
||||
print(f'\tAverage ping: {round(csum / ccounts, 4)}ms ({ccounts} of {row_count} requests)')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
v1()
|
||||
|
Reference in New Issue
Block a user