Skip to content

Commit 008492c

Browse files
committed
more info
1 parent 58b79f5 commit 008492c

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

chia/cmds/dev/data.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ async def run(self) -> None:
118118
clock = time.monotonic
119119
start = clock()
120120

121+
last_generation = -1
122+
clock = time.monotonic
123+
last_time = clock()
124+
all_times: dict[int, float] = {}
125+
121126
task = create_referenced_task(
122127
insert_from_delta_file(
123128
data_store=data_store,
@@ -133,7 +138,6 @@ async def run(self) -> None:
133138
downloader=None,
134139
)
135140
)
136-
last_generation = -1
137141
try:
138142
while not task.done():
139143
try:
@@ -143,8 +147,21 @@ async def run(self) -> None:
143147
raise
144148
else:
145149
if generation != last_generation:
150+
delta_generation = generation - last_generation
151+
now = clock()
152+
delta_time = now - last_time
153+
per_generation = delta_time / delta_generation
154+
155+
print_date(
156+
f"synced: {last_generation} -> {generation} at {per_generation:.1f}s / gen",
157+
flush=True,
158+
)
159+
160+
for i in range(generation, last_generation, -1):
161+
all_times[i] = per_generation
162+
146163
last_generation = generation
147-
print_date(f"synced to: {generation}")
164+
last_time = now
148165
await asyncio.sleep(1)
149166
except asyncio.CancelledError:
150167
with anyio.CancelScope(shield=True):
@@ -161,6 +178,8 @@ async def run(self) -> None:
161178
print(f" store id: {self.store_id}")
162179
print(f" reached: {self.generation_limit}")
163180
print(f" duration: {days}d {hours}h {minutes}m {seconds}s")
181+
generation, duration = max(all_times.items(), key=lambda item: item[1])
182+
print(f" max: {generation} -> {duration:.1f}s")
164183
finally:
165184
with anyio.CancelScope(shield=True):
166185
await self.run_chia("stop", "-d", "all", check=False)

0 commit comments

Comments
 (0)