Two more load monitoring hooks.

This commit is contained in:
JoelKatz
2012-11-20 12:09:51 -08:00
parent e837988481
commit 5ac22ff31b
5 changed files with 17 additions and 5 deletions

View File

@@ -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";
}
}

View File

@@ -36,6 +36,7 @@ enum JobType
jtCLIENT = 10,
jtPEER = 11,
jtDISK = 12,
jtLEDGER = 13,
};
#define NUM_JOB_TYPES 16

View File

@@ -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());

View File

@@ -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&);

View File

@@ -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