Make sure all load sources are named.

This commit is contained in:
JoelKatz
2013-03-04 16:22:09 -08:00
parent 93f79ca204
commit d1169ee86d
11 changed files with 20 additions and 19 deletions

View File

@@ -223,7 +223,7 @@ void SqliteDatabase::doHook(const char *db, int pages)
{ {
walRunning = true; walRunning = true;
if (mWalQ) if (mWalQ)
mWalQ->addJob(jtWAL, std::string("WAL:") + db, boost::bind(&SqliteDatabase::runWal, this)); mWalQ->addJob(jtWAL, std::string("WAL:") + mHost, boost::bind(&SqliteDatabase::runWal, this));
else else
boost::thread(boost::bind(&SqliteDatabase::runWal, this)).detach(); boost::thread(boost::bind(&SqliteDatabase::runWal, this)).detach();
} }

View File

@@ -66,11 +66,11 @@ public:
Job(JobType type, const std::string& name, uint64 index, LoadMonitor& lm, const boost::function<void(Job&)>& job) Job(JobType type, const std::string& name, uint64 index, LoadMonitor& lm, const boost::function<void(Job&)>& job)
: mType(type), mJobIndex(index), mJob(job), mName(name) : mType(type), mJobIndex(index), mJob(job), mName(name)
{ {
mLoadMonitor = boost::make_shared<LoadEvent>(boost::ref(lm), false, 1); mLoadMonitor = boost::make_shared<LoadEvent>(boost::ref(lm), name, false, 1);
} }
JobType getType() const { return mType; } JobType getType() const { return mType; }
void doJob(void) { mLoadMonitor->start(); mJob(*this); mLoadMonitor->setName(mName); } void doJob(void) { mLoadMonitor->start(); mJob(*this); mLoadMonitor->reName(mName); }
void rename(const std::string& n) { mName = n; } void rename(const std::string& n) { mName = n; }
bool operator<(const Job& j) const; bool operator<(const Job& j) const;
@@ -110,10 +110,10 @@ public:
void shutdown(); void shutdown();
void setThreadCount(int c = 0); void setThreadCount(int c = 0);
LoadEvent::pointer getLoadEvent(JobType t) LoadEvent::pointer getLoadEvent(JobType t, const std::string& name)
{ return boost::make_shared<LoadEvent>(boost::ref(mJobLoads[t]), true, 1); } { return boost::make_shared<LoadEvent>(boost::ref(mJobLoads[t]), name, true, 1); }
LoadEvent::autoptr getLoadEventAP(JobType t) LoadEvent::autoptr getLoadEventAP(JobType t, const std::string& name)
{ return LoadEvent::autoptr(new LoadEvent(mJobLoads[t], true, 1)); } { return LoadEvent::autoptr(new LoadEvent(mJobLoads[t], name, true, 1)); }
int isOverloaded(); int isOverloaded();
Json::Value getJson(int c = 0); Json::Value getJson(int c = 0);

View File

@@ -1530,8 +1530,8 @@ void Ledger::pendSave(bool fromConsensus)
++sPendingSaves; ++sPendingSaves;
} }
boost::thread(boost::bind(&Ledger::saveAcceptedLedger, shared_from_this(), boost::thread(boost::bind(&Ledger::saveAcceptedLedger, shared_from_this(), fromConsensus,
fromConsensus, theApp->getJobQueue().getLoadEvent(jtDISK))).detach(); theApp->getJobQueue().getLoadEvent(jtDISK, fromConsensus ? "Ledger::cSave" : "Ledger::save"))).detach();
} }

View File

@@ -1091,7 +1091,7 @@ void LedgerConsensus::beginAccept(bool synchronous)
else 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(jtACCEPTLEDGER))); theApp->getJobQueue().getLoadEvent(jtACCEPTLEDGER, "LedgerConsensus::beginAccept")));
} }
} }

View File

@@ -64,7 +64,8 @@ protected:
boost::posix_time::ptime mStartTime; boost::posix_time::ptime mStartTime;
public: public:
LoadEvent(LoadMonitor& monitor, bool shouldStart, int count) : mMonitor(monitor), mRunning(false), mCount(count) LoadEvent(LoadMonitor& monitor, const std::string& name, bool shouldStart, int count) :
mMonitor(monitor), mRunning(false), mCount(count), mName(name)
{ {
mStartTime = boost::posix_time::microsec_clock::universal_time(); mStartTime = boost::posix_time::microsec_clock::universal_time();
if (shouldStart) if (shouldStart)
@@ -77,7 +78,7 @@ public:
stop(); stop();
} }
void setName(const std::string& name) void reName(const std::string& name)
{ {
mName = name; mName = name;
} }

View File

@@ -259,7 +259,7 @@ void NetworkOPs::runTransactionQueue()
return; return;
{ {
LoadEvent::autoptr ev = theApp->getJobQueue().getLoadEventAP(jtTXN_PROC); LoadEvent::autoptr ev = theApp->getJobQueue().getLoadEventAP(jtTXN_PROC, "runTxnQ");
boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock()); boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock());
@@ -328,7 +328,7 @@ void NetworkOPs::runTransactionQueue()
Transaction::pointer NetworkOPs::processTransaction(Transaction::pointer trans, stCallback callback) Transaction::pointer NetworkOPs::processTransaction(Transaction::pointer trans, stCallback callback)
{ {
LoadEvent::autoptr ev = theApp->getJobQueue().getLoadEventAP(jtTXN_PROC); LoadEvent::autoptr ev = theApp->getJobQueue().getLoadEventAP(jtTXN_PROC, "ProcessTXN");
int newFlags = theApp->getSuppression().getFlags(trans->getID()); int newFlags = theApp->getSuppression().getFlags(trans->getID());
if ((newFlags & SF_BAD) != 0) if ((newFlags & SF_BAD) != 0)

View File

@@ -26,7 +26,7 @@ void OrderBookDB::setup(Ledger::ref ledger)
return; return;
mSeq = ledger->getLedgerSeq(); mSeq = ledger->getLedgerSeq();
LoadEvent::autoptr ev = theApp->getJobQueue().getLoadEventAP(jtOB_SETUP); LoadEvent::autoptr ev = theApp->getJobQueue().getLoadEventAP(jtOB_SETUP, "OrderBookDB::setup");
mXRPOrders.clear(); mXRPOrders.clear();
mIssuerMap.clear(); mIssuerMap.clear();

View File

@@ -141,7 +141,7 @@ Pathfinder::Pathfinder(Ledger::ref ledger,
theApp->getOrderBookDB().setup(mLedger); theApp->getOrderBookDB().setup(mLedger);
mLoadMonitor = theApp->getJobQueue().getLoadEvent(jtPATH_FIND); mLoadMonitor = theApp->getJobQueue().getLoadEvent(jtPATH_FIND, "FindPath");
// Construct the default path for later comparison. // Construct the default path for later comparison.

View File

@@ -424,7 +424,7 @@ void Peer::processReadBuffer()
// std::cerr << "Peer::processReadBuffer: " << mIpPort.first << " " << mIpPort.second << std::endl; // std::cerr << "Peer::processReadBuffer: " << mIpPort.first << " " << mIpPort.second << std::endl;
LoadEvent::autoptr event(theApp->getJobQueue().getLoadEventAP(jtPEER)); LoadEvent::autoptr event(theApp->getJobQueue().getLoadEventAP(jtPEER, "Peer::read"));
boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock()); boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock());

View File

@@ -2879,7 +2879,7 @@ Json::Value RPCHandler::doCommand(const Json::Value& jvRequest, int iRole)
cLog(lsTRACE) << "COMMAND:" << strCommand; cLog(lsTRACE) << "COMMAND:" << strCommand;
cLog(lsTRACE) << "REQUEST:" << jvRequest; cLog(lsTRACE) << "REQUEST:" << jvRequest;
LoadEvent::autoptr le(theApp->getJobQueue().getLoadEventAP(jtRPC)); LoadEvent::autoptr le(theApp->getJobQueue().getLoadEventAP(jtRPC, "RPC"));
mRole = iRole; mRole = iRole;

View File

@@ -299,7 +299,7 @@ void ValidationCollection::condWrite()
void ValidationCollection::doWrite(Job&) void ValidationCollection::doWrite(Job&)
{ {
LoadEvent::autoptr event(theApp->getJobQueue().getLoadEventAP(jtDISK)); LoadEvent::autoptr event(theApp->getJobQueue().getLoadEventAP(jtDISK, "ValidationWrite"));
static boost::format insVal("INSERT INTO Validations " static boost::format insVal("INSERT INTO Validations "
"(LedgerHash,NodePubKey,SignTime,RawData) VALUES ('%s','%s','%u',%s);"); "(LedgerHash,NodePubKey,SignTime,RawData) VALUES ('%s','%s','%u',%s);");