Added utility to parse performance logs.

This commit is contained in:
Pedro Pinto committed 2020-12-17 09:40:04 -05:00
1 parent 43f4fe2011
commit ebd0fa4809
1 file changed
+14 -2
@@ -315,5 +315,17 @@ def ib_percentage(fills,begin_eid,event_len):
'SIDE_BUY':ib_percentage_side(ibs['SIDE_BUY'])
}
def parse_latency_logs(file,out_path):
rx = ".*\|Latency.*\|PROD\|(.*)"
with open(out_path,mode='w') as out_file:
with open(file) as f:
for l in f.readlines():
m = re.match(rx,l)
if m:
log = m.groups()[0]
log = log.strip()
log = log.replace("::","_")
row = { nv[0]:nv[1] for nv in [ kv.split(':') for kv in log.strip().split(" ") ] }
if row['sn'] != '0':
print (row['sn'],",",row['entry_type'],",",row['app_arrival'],",",row['now'],file=out_file)