I recently setup up a new node and was perplexed why processing the chain took longer than expected.
I'm downloading from another node on my local gigabit network, so bandwidth wasn't my bottleneck.
I saw a
-debug flag with a
bench property, so I enabled this setting. Long story short, the disk I used was really slow.
Anyways, I came across some code that doesn't seem to time anything of value:
int64_t nTime5 = GetTimeMicros(); nTimeIndex += nTime5 - nTime4;
LogPrint(BCLog::BENCH, " - Index writing: %.2fms [%.2fs (%.2fms/blk)]\n", MILLI * (nTime5 - nTime4), nTimeIndex * MICRO, nTimeIndex * MILLI / nBlocksTotal);
int64_t nTime6 = GetTimeMicros(); nTimeCallbacks += nTime6 - nTime5;
LogPrint(BCLog::BENCH, " - Callbacks: %.2fms [%.2fs (%.2fms/blk)]\n", MILLI * (nTime6 - nTime5), nTimeCallbacks * MICRO, nTimeCallbacks * MILLI / nBlocksTotal);
This is in
https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L1873Correct if I'm wrong, but it seems
"Callbacks" is timing the execution of the
"Index writing" LogPrintf along with some basic computations (nTime6 - nTime5)
Inspection of my
debug.log indicates a consistent time of around ~20-30 microseconds.
Is this timing anything of value?
Callbacks bench was added (I think) in this commit:
https://github.com/bitcoin/bitcoin/commit/d70bc52ee31b8c4c87ee011625e7031c2dc89c0cIf this is dead (legacy) code, I'll open merge request and remove it. Could someone confirm ?
Thanks.