Skip to content

Commit 8ecd342

Browse files
committed
print tps
1 parent 092f482 commit 8ecd342

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

testground/benchmark/benchmark/main.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
import subprocess
33
from pathlib import Path
44

5-
import web3
6-
75
from .cli import ChainCommand
86
from .context import Context
97
from .peer import CONTAINER_CRONOSD_PATH, bootstrap
10-
from .sendtx import generate_load
8+
from .sendtx import collect_output, generate_load
119
from .utils import wait_for_block, wait_for_port
1210

1311

@@ -43,11 +41,7 @@ def entrypoint(ctx: Context):
4341
)
4442

4543
if ctx.is_fullnode_leader:
46-
# collect output
47-
w3 = web3.Web3(web3.providers.HTTPProvider("http://localhost:8545"))
48-
for i in range(w3.eth.block_number):
49-
blk = w3.eth.get_block(i)
50-
print(i, len(blk.transactions), blk.timestamp)
44+
collect_output()
5145

5246
# halt after all tasks are done
5347
ctx.sync.signal_and_wait("halt", ctx.params.test_instance_count)

testground/benchmark/benchmark/sendtx.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,11 @@ def generate_load(cli, num_accounts, num_txs, **kwargs):
6969
fut.result()
7070
except Exception as e:
7171
print("test task failed", e)
72+
73+
74+
def collect_output():
75+
# collect output
76+
w3 = web3.Web3(web3.providers.HTTPProvider("http://localhost:8545"))
77+
for i in range(w3.eth.block_number):
78+
blk = w3.eth.get_block(i)
79+
print(i, len(blk.transactions), blk.timestamp)

testground/benchmark/benchmark/stateless.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
init_node,
1717
patch_configs,
1818
)
19-
from .sendtx import generate_load
19+
from .sendtx import collect_output, generate_load
2020
from .topology import connect_all
2121
from .types import PeerPacket
2222
from .utils import wait_for_block, wait_for_port
@@ -95,7 +95,7 @@ def run(
9595
proc.wait()
9696
else:
9797
generate_load(cli, num_accounts, num_txs, home=home)
98-
98+
collect_output()
9999
proc.kill()
100100
try:
101101
proc.wait()

0 commit comments

Comments
 (0)