print average block rate at different block height windows (#11064)

This commit is contained in:
Arvid Norberg 2022-04-06 01:11:03 +02:00 committed by GitHub
parent bb57ccffa9
commit 492503f109
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,6 +83,7 @@ async def run_sync_test(file: Path, db_version, profile: bool, single_thread: bo
print()
counter = 0
height = 0
async with aiosqlite.connect(file) as in_db:
rows = await in_db.execute(
@ -109,10 +110,16 @@ async def run_sync_test(file: Path, db_version, profile: bool, single_thread: bo
assert success
assert advanced_peak
counter += len(block_batch)
print(f"\rheight {counter} {counter/(time.monotonic() - start_time):0.2f} blocks/s ", end="")
height += len(block_batch)
print(f"\rheight {height} {counter/(time.monotonic() - start_time):0.2f} blocks/s ", end="")
block_batch = []
if check_log.exit_with_failure:
raise RuntimeError("error printed to log. exiting")
if counter >= 100000:
start_time = time.monotonic()
counter = 0
print()
finally:
print("closing full node")
full_node._close()