Skip to content

Commit 359e18d

Browse files
committed
measure entry exec time
1 parent 7e80b5b commit 359e18d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ex/lib/consensus/fabric_gen.ex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,19 @@ defmodule FabricGen do
293293
def apply_entry_1(next_entry) do
294294
%{db: db, cf: cf} = :persistent_term.get({:rocksdb, Fabric})
295295

296+
start_contract_exec = :os.system_time(1000)
297+
296298
entry = next_entry
297299
{rtx, m, m_rev, receipts, root_receipts, root_contractstate} = RDB.apply_entry(db, RDB.vecpak_encode(entry),
298300
Application.fetch_env!(:ama, :trainer_pk), Application.fetch_env!(:ama, :trainer_sk),
299301
!!Application.fetch_env!(:ama, :testnet), Map.keys(Application.fetch_env!(:ama, :keys_by_pk))
300302
)
303+
304+
took_contract_exec = :os.system_time(1000) - start_contract_exec
305+
if took_contract_exec > 100 do
306+
IO.puts "Contract Exec took #{took_contract_exec}ms"
307+
end
308+
301309
rebuild_m_fn = fn(m)->
302310
Enum.map(m, fn(inner)->
303311
op = :"#{IO.iodata_to_binary(inner[~c"op"])}"

0 commit comments

Comments
 (0)