47
47
#include < util/rbf.h>
48
48
#include < util/strencodings.h>
49
49
#include < util/system.h>
50
+ #include < util/time.h>
50
51
#include < util/trace.h>
51
52
#include < util/translation.h>
52
53
#include < validationinterface.h>
53
54
#include < warnings.h>
54
55
55
56
#include < algorithm>
57
+ #include < chrono>
56
58
#include < deque>
57
59
#include < numeric>
58
60
#include < optional>
@@ -4726,7 +4728,7 @@ bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate, FopenFn mocka
4726
4728
4727
4729
bool DumpMempool (const CTxMemPool& pool, FopenFn mockable_fopen_function, bool skip_file_commit)
4728
4730
{
4729
- int64_t start = GetTimeMicros ();
4731
+ auto start = SteadyClock::now ();
4730
4732
4731
4733
std::map<uint256, CAmount> mapDeltas;
4732
4734
std::vector<TxMempoolInfo> vinfo;
@@ -4744,7 +4746,7 @@ bool DumpMempool(const CTxMemPool& pool, FopenFn mockable_fopen_function, bool s
4744
4746
unbroadcast_txids = pool.GetUnbroadcastTxs ();
4745
4747
}
4746
4748
4747
- int64_t mid = GetTimeMicros ();
4749
+ auto mid = SteadyClock::now ();
4748
4750
4749
4751
try {
4750
4752
FILE* filestr{mockable_fopen_function (gArgs .GetDataDirNet () / " mempool.dat.new" , " wb" )};
@@ -4776,8 +4778,11 @@ bool DumpMempool(const CTxMemPool& pool, FopenFn mockable_fopen_function, bool s
4776
4778
if (!RenameOver (gArgs .GetDataDirNet () / " mempool.dat.new" , gArgs .GetDataDirNet () / " mempool.dat" )) {
4777
4779
throw std::runtime_error (" Rename failed" );
4778
4780
}
4779
- int64_t last = GetTimeMicros ();
4780
- LogPrintf (" Dumped mempool: %gs to copy, %gs to dump\n " , (mid-start)*MICRO, (last-mid)*MICRO);
4781
+ auto last = SteadyClock::now ();
4782
+
4783
+ LogPrintf (" Dumped mempool: %gs to copy, %gs to dump\n " ,
4784
+ Ticks<SecondsDouble>(mid - start),
4785
+ Ticks<SecondsDouble>(last - mid));
4781
4786
} catch (const std::exception& e) {
4782
4787
LogPrintf (" Failed to dump mempool: %s. Continuing anyway.\n " , e.what ());
4783
4788
return false ;
0 commit comments