mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-10 14:26:26 +00:00
add setting for benchmarking and profiling of sqlite block storage times (#1575)
This commit is contained in:
parent
c810b64ed8
commit
b8da265f89
@ -14,6 +14,7 @@ type Timers = enum
|
|||||||
tLoadState = "Load state from database"
|
tLoadState = "Load state from database"
|
||||||
tApplyBlock = "Apply block"
|
tApplyBlock = "Apply block"
|
||||||
tApplyEpochBlock = "Apply epoch block"
|
tApplyEpochBlock = "Apply epoch block"
|
||||||
|
tDbStore = "Database block store"
|
||||||
|
|
||||||
type
|
type
|
||||||
DbCmd* = enum
|
DbCmd* = enum
|
||||||
@ -39,6 +40,9 @@ type
|
|||||||
slots* {.
|
slots* {.
|
||||||
defaultValue: 50000
|
defaultValue: 50000
|
||||||
desc: "Number of slots to run benchmark for".}: uint64
|
desc: "Number of slots to run benchmark for".}: uint64
|
||||||
|
storeBlocks* {.
|
||||||
|
defaultValue: false
|
||||||
|
desc: "Store each read block back into a separate database".}: bool
|
||||||
|
|
||||||
of dumpState:
|
of dumpState:
|
||||||
stateRoot* {.
|
stateRoot* {.
|
||||||
@ -66,6 +70,8 @@ proc cmdBench(conf: DbConf) =
|
|||||||
let
|
let
|
||||||
db = BeaconChainDB.init(
|
db = BeaconChainDB.init(
|
||||||
kvStore SqStoreRef.init(conf.databaseDir.string, "nbc").tryGet())
|
kvStore SqStoreRef.init(conf.databaseDir.string, "nbc").tryGet())
|
||||||
|
dbBenchmark = BeaconChainDB.init(
|
||||||
|
kvStore SqStoreRef.init(".", "benchmark").tryGet())
|
||||||
|
|
||||||
if not ChainDAGRef.isInitialized(db):
|
if not ChainDAGRef.isInitialized(db):
|
||||||
echo "Database not initialized"
|
echo "Database not initialized"
|
||||||
@ -109,6 +115,9 @@ proc cmdBench(conf: DbConf) =
|
|||||||
dump("./", b)
|
dump("./", b)
|
||||||
echo "State transition failed (!)"
|
echo "State transition failed (!)"
|
||||||
quit 1
|
quit 1
|
||||||
|
if conf.storeBlocks:
|
||||||
|
withTimer(timers[tDbStore]):
|
||||||
|
dbBenchmark.putBlock(b)
|
||||||
|
|
||||||
printTimers(false, timers)
|
printTimers(false, timers)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user