Skip to content

Commit

Permalink
[bin/graph] Skip previous syncs (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Aug 29, 2022
1 parent 6caeb41 commit 602ca3b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
26 changes: 18 additions & 8 deletions bin/graph
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

import re
import re, sys
from matplotlib.pyplot import *
from dataclasses import dataclass

Expand All @@ -19,31 +19,41 @@ pat = re.compile(
blocks = [
Block(**{k : int(v) for k, v in group.items()})
for group in [
match.groupdict() for match in pat.finditer(open('ord.log').read())
match.groupdict() for match in pat.finditer(open(sys.argv[1]).read())
]
]

start = 0

for i in range(len(blocks)):
if blocks[i].height == 1:
start = i

print(f"Skipping {start + 1} blocks from previous sync")

sync = blocks[start:]

_, (a, b, c) = subplots(3)

a.set_xlabel('Height')
a.set_ylabel('Time')
a.plot(
[block.height for block in blocks],
[block.time for block in blocks],
[block.height for block in sync],
[block.time for block in sync],
)

b.set_xlabel('Ranges')
b.set_ylabel('Time')
b.scatter(
[block.ranges for block in blocks],
[block.time for block in blocks],
[block.ranges for block in sync],
[block.time for block in sync],
)

c.set_xlabel('Tx\'s in block')
c.set_ylabel('Time')
c.scatter(
[block.transactions for block in blocks],
[block.time for block in blocks],
[block.transactions for block in sync],
[block.time for block in sync],
)

show()
6 changes: 5 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,9 @@ update-modern-normalize:
https://raw.githubusercontent.com/sindresorhus/modern-normalize/main/modern-normalize.css \
> static/modern-normalize.css

download-log host="ordinals.com":
ssh root@{{host}} 'journalctl -u ord > ord.log'
rsync --progress root@{{host}}:ord.log ord.log

graph:
./bin/graph
./bin/graph ord.log

0 comments on commit 602ca3b

Please sign in to comment.