Expected behavior
LogPrint BCLog::BENCH should print useful timing metrics
Actual behavior
Callbacks bench logs the execution time of LogPrint(BCLog::BENCH, " - Index writing:... function call
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);
https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L1873
Callbacks bench was added in this commit: https://github.com/bitcoin/bitcoin/commit/d70bc52ee31b8c4c87ee011625e7031c2dc89c0c
Since then functions between Index writing: and Callbacks: were moved.
Now Callbacks bench isn't recording anything of value.
Appears to be timing the execution of the Index writing LogPrintf along with some basic computations (nTime6 - nTime5)
To reproduce
Start a node with initial block download
bitcoind -debug=bench | grep Callbacks:
You'll see the times recorded are within a small bounded range. On my system it was between 30-50 microseconds
System information
Self-complied tag v22.0 on Arch Linux x86s AMD Ryzen 5 with SSD and 8 gigs ram
I will open a PR to remove this code