Skip to content
Snippets Groups Projects
Commit a7b38cf2 authored by 42loop's avatar 42loop
Browse files

added max ping time stat

parent 894ff7ca
Branches master
No related tags found
No related merge requests found
......@@ -23,15 +23,17 @@ for fname in all_logs:
bad_pings=0
good_pings=0
avg_time=0
max_ping_time=0
consecutive_bad=0
# consider consecutive_bad_max as power down indicator
consecutive_bad_max=60
consecutive_bad_max=6
for i, line in enumerate(open(fname)):
#print(i,line)
lastline=line
# cut off the beginning because there were double ping processes writing to same file
# cut off the beginning because (on meshgate) there were double ping processes writing to same file
if i<3500:
continue
......@@ -56,13 +58,17 @@ for fname in all_logs:
if line.find("time=")<0:
bad_pings+=1
consecutive_bad+=1
print(line)
#print(line)
else:
good_pings+=1
consecutive_bad=0
t_ms=re.findall(r"time=\w+.\w+ ms",line)
avg_time=(avg_time+float(t_ms[0][5:-2]))/2
tms=float(t_ms[0][5:-2])
max_ping_time=max(max_ping_time,tms)
avg_time=(avg_time+tms)/2
if consecutive_bad>consecutive_bad_max:
break
......@@ -77,4 +83,6 @@ for fname in all_logs:
print("last: line",i,dt_end,"seconds: ",tsdiff, "hours: ", tsdiff/3600)
print("bad pings: ",bad_pings, "(",round(bad_pings/(tsdiff/100)),"%)")
print("average ping time: ",avg_time)
print("max ping time: ",max_ping_time)
print("___________________________________________________________")
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment