Created
March 23, 2021 04:14
-
-
Save alfondotnet/6ec2a7b08d87f316c395f1ace9beb596 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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