Skip to content

Instantly share code, notes, and snippets.

@alfondotnet
Created March 23, 2021 04:14
Show Gist options
  • Save alfondotnet/6ec2a7b08d87f316c395f1ace9beb596 to your computer and use it in GitHub Desktop.
Save alfondotnet/6ec2a7b08d87f316c395f1ace9beb596 to your computer and use it in GitHub Desktop.
from datetime import datetime
file = open('/home/user/.chia/mainnet/log/debug.log')
old_timestamp = None
res_by_int_deltas = {}
for l in file:
if 'Found' not in l:
continue
ts = datetime.strptime(l.split(' ')[0], '%H:%M:%S.%f')
if old_timestamp:
diff = int((ts - old_timestamp).total_seconds())
if diff in res_by_int_deltas:
res_by_int_deltas[diff] += 1
else:
res_by_int_deltas[diff] = 1
old_timestamp = ts
print(res_by_int_deltas)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment