@@ -1711,6 +1711,8 @@ void PartitionCheck(bool (*initialDownloadCheck)(), CCriticalSection& cs, const
1711
1711
}
1712
1712
}
1713
1713
1714
+ static int64_t nTimeCheck = 0 ;
1715
+ static int64_t nTimeForks = 0 ;
1714
1716
static int64_t nTimeVerify = 0 ;
1715
1717
static int64_t nTimeConnect = 0 ;
1716
1718
static int64_t nTimeIndex = 0 ;
@@ -1721,6 +1723,9 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
1721
1723
{
1722
1724
const CChainParams& chainparams = Params ();
1723
1725
AssertLockHeld (cs_main);
1726
+
1727
+ int64_t nTimeStart = GetTimeMicros ();
1728
+
1724
1729
// Check it again in case a previous version let a bad block in
1725
1730
if (!CheckBlock (block, state, !fJustCheck , !fJustCheck ))
1726
1731
return false ;
@@ -1746,6 +1751,9 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
1746
1751
}
1747
1752
}
1748
1753
1754
+ int64_t nTime1 = GetTimeMicros (); nTimeCheck += nTime1 - nTimeStart;
1755
+ LogPrint (" bench" , " - Sanity checks: %.2fms [%.2fs]\n " , 0.001 * (nTime1 - nTimeStart), nTimeCheck * 0.000001 );
1756
+
1749
1757
// Do not allow blocks that contain transactions which 'overwrite' older transactions,
1750
1758
// unless those are already completely spent.
1751
1759
// If such overwrites are allowed, coinbases and transactions depending upon those
@@ -1788,11 +1796,13 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
1788
1796
flags |= SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY;
1789
1797
}
1790
1798
1799
+ int64_t nTime2 = GetTimeMicros (); nTimeForks += nTime2 - nTime1;
1800
+ LogPrint (" bench" , " - Fork checks: %.2fms [%.2fs]\n " , 0.001 * (nTime2 - nTime1), nTimeForks * 0.000001 );
1801
+
1791
1802
CBlockUndo blockundo;
1792
1803
1793
1804
CCheckQueueControl<CScriptCheck> control (fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL );
1794
1805
1795
- int64_t nTimeStart = GetTimeMicros ();
1796
1806
CAmount nFees = 0 ;
1797
1807
int nInputs = 0 ;
1798
1808
unsigned int nSigOps = 0 ;
@@ -1845,8 +1855,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
1845
1855
vPos.push_back (std::make_pair (tx.GetHash (), pos));
1846
1856
pos.nTxOffset += ::GetSerializeSize (tx, SER_DISK, CLIENT_VERSION);
1847
1857
}
1848
- int64_t nTime1 = GetTimeMicros (); nTimeConnect += nTime1 - nTimeStart ;
1849
- LogPrint (" bench" , " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs]\n " , (unsigned )block.vtx .size (), 0.001 * (nTime1 - nTimeStart ), 0.001 * (nTime1 - nTimeStart ) / block.vtx .size (), nInputs <= 1 ? 0 : 0.001 * (nTime1 - nTimeStart ) / (nInputs-1 ), nTimeConnect * 0.000001 );
1858
+ int64_t nTime3 = GetTimeMicros (); nTimeConnect += nTime3 - nTime2 ;
1859
+ LogPrint (" bench" , " - Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin) [%.2fs]\n " , (unsigned )block.vtx .size (), 0.001 * (nTime3 - nTime2 ), 0.001 * (nTime3 - nTime2 ) / block.vtx .size (), nInputs <= 1 ? 0 : 0.001 * (nTime3 - nTime2 ) / (nInputs-1 ), nTimeConnect * 0.000001 );
1850
1860
1851
1861
CAmount blockReward = nFees + GetBlockSubsidy (pindex->nHeight , chainparams.GetConsensus ());
1852
1862
if (block.vtx [0 ].GetValueOut () > blockReward)
@@ -1857,8 +1867,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
1857
1867
1858
1868
if (!control.Wait ())
1859
1869
return state.DoS (100 , false );
1860
- int64_t nTime2 = GetTimeMicros (); nTimeVerify += nTime2 - nTimeStart ;
1861
- LogPrint (" bench" , " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs]\n " , nInputs - 1 , 0.001 * (nTime2 - nTimeStart ), nInputs <= 1 ? 0 : 0.001 * (nTime2 - nTimeStart ) / (nInputs-1 ), nTimeVerify * 0.000001 );
1870
+ int64_t nTime4 = GetTimeMicros (); nTimeVerify += nTime4 - nTime2 ;
1871
+ LogPrint (" bench" , " - Verify %u txins: %.2fms (%.3fms/txin) [%.2fs]\n " , nInputs - 1 , 0.001 * (nTime4 - nTime2 ), nInputs <= 1 ? 0 : 0.001 * (nTime4 - nTime2 ) / (nInputs-1 ), nTimeVerify * 0.000001 );
1862
1872
1863
1873
if (fJustCheck )
1864
1874
return true ;
@@ -1889,16 +1899,16 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
1889
1899
// add this block to the view's block chain
1890
1900
view.SetBestBlock (pindex->GetBlockHash ());
1891
1901
1892
- int64_t nTime3 = GetTimeMicros (); nTimeIndex += nTime3 - nTime2 ;
1893
- LogPrint (" bench" , " - Index writing: %.2fms [%.2fs]\n " , 0.001 * (nTime3 - nTime2 ), nTimeIndex * 0.000001 );
1902
+ int64_t nTime5 = GetTimeMicros (); nTimeIndex += nTime5 - nTime4 ;
1903
+ LogPrint (" bench" , " - Index writing: %.2fms [%.2fs]\n " , 0.001 * (nTime5 - nTime4 ), nTimeIndex * 0.000001 );
1894
1904
1895
1905
// Watch for changes to the previous coinbase transaction.
1896
1906
static uint256 hashPrevBestCoinBase;
1897
1907
GetMainSignals ().UpdatedTransaction (hashPrevBestCoinBase);
1898
1908
hashPrevBestCoinBase = block.vtx [0 ].GetHash ();
1899
1909
1900
- int64_t nTime4 = GetTimeMicros (); nTimeCallbacks += nTime4 - nTime3 ;
1901
- LogPrint (" bench" , " - Callbacks: %.2fms [%.2fs]\n " , 0.001 * (nTime4 - nTime3 ), nTimeCallbacks * 0.000001 );
1910
+ int64_t nTime6 = GetTimeMicros (); nTimeCallbacks += nTime6 - nTime5 ;
1911
+ LogPrint (" bench" , " - Callbacks: %.2fms [%.2fs]\n " , 0.001 * (nTime6 - nTime5 ), nTimeCallbacks * 0.000001 );
1902
1912
1903
1913
return true ;
1904
1914
}
0 commit comments