mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Two more load monitoring hooks.
This commit is contained in:
@@ -23,6 +23,7 @@ const char* Job::toString(JobType t)
|
||||
case jtCLIENT: return "clientCommand";
|
||||
case jtPEER: return "peerCommand";
|
||||
case jtDISK: return "diskAccess";
|
||||
case jtLEDGER: return "acceptLedger";
|
||||
default: assert(false); return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ enum JobType
|
||||
jtCLIENT = 10,
|
||||
jtPEER = 11,
|
||||
jtDISK = 12,
|
||||
jtLEDGER = 13,
|
||||
};
|
||||
#define NUM_JOB_TYPES 16
|
||||
|
||||
|
||||
@@ -1021,9 +1021,12 @@ void LedgerConsensus::beginAccept(bool synchronous)
|
||||
|
||||
theApp->getOPs().newLCL(mPeerPositions.size(), mCurrentMSeconds, mNewLedgerHash);
|
||||
if (synchronous)
|
||||
accept(consensusSet);
|
||||
accept(consensusSet, LoadEvent::pointer());
|
||||
else
|
||||
theApp->getIOService().post(boost::bind(&LedgerConsensus::accept, shared_from_this(), consensusSet));
|
||||
{
|
||||
theApp->getIOService().post(boost::bind(&LedgerConsensus::accept, shared_from_this(), consensusSet,
|
||||
theApp->getJobQueue().getLoadEvent(jtLEDGER)));
|
||||
}
|
||||
}
|
||||
|
||||
void LedgerConsensus::playbackProposals()
|
||||
@@ -1170,7 +1173,7 @@ uint32 LedgerConsensus::roundCloseTime(uint32 closeTime)
|
||||
return closeTime - (closeTime % mCloseResolution);
|
||||
}
|
||||
|
||||
void LedgerConsensus::accept(SHAMap::ref set)
|
||||
void LedgerConsensus::accept(SHAMap::ref set, LoadEvent::pointer)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock masterLock(theApp->getMasterLock());
|
||||
assert(set->getHash() == mOurPosition->getCurrentHash());
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "CanonicalTXSet.h"
|
||||
#include "TransactionEngine.h"
|
||||
#include "InstanceCounter.h"
|
||||
#include "LoadMonitor.h"
|
||||
|
||||
DEFINE_INSTANCE(LedgerConsensus);
|
||||
|
||||
@@ -120,7 +121,7 @@ protected:
|
||||
boost::unordered_set<uint160> mDeadNodes;
|
||||
|
||||
// final accept logic
|
||||
void accept(SHAMap::ref txSet);
|
||||
void accept(SHAMap::ref txSet, LoadEvent::pointer);
|
||||
|
||||
void weHave(const uint256& id, Peer::ref avoidPeer);
|
||||
void startAcquiring(const TransactionAcquire::pointer&);
|
||||
|
||||
@@ -53,13 +53,19 @@ SerializedTransaction::pointer TransactionMaster::fetch(SHAMapItem::ref item, bo
|
||||
return txn;
|
||||
}
|
||||
|
||||
static void saveTransactionHelper(Transaction::pointer txn, LoadEvent::pointer)
|
||||
{
|
||||
Transaction::saveTransaction(txn);
|
||||
}
|
||||
|
||||
bool TransactionMaster::canonicalize(Transaction::pointer& txn, bool may_be_new)
|
||||
{
|
||||
uint256 tid = txn->getID();
|
||||
if (!tid) return false;
|
||||
if (mCache.canonicalize(tid, txn)) return true;
|
||||
if (may_be_new)
|
||||
theApp->getAuxService().post(boost::bind(&Transaction::saveTransaction, txn));
|
||||
theApp->getAuxService().post(boost::bind(&saveTransactionHelper, txn,
|
||||
theApp->getJobQueue().getLoadEvent(jtDISK)));
|
||||
return false;
|
||||
}
|
||||
// vim:ts=4
|
||||
|
||||
Reference in New Issue
Block a user