diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index 292ba7d483..2809fd3ad0 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -49,6 +50,8 @@ #include #include +using namespace std::chrono_literals; + namespace ripple { RCLConsensus::RCLConsensus( @@ -140,11 +143,17 @@ RCLConsensus::Adaptor::acquireLedger(LedgerHash const& hash) app_.getJobQueue().addJob( jtADVANCE, "getConsensusLedger1", - [id = hash, &app = app_, this]() { - JLOG(j_.debug()) - << "JOB advanceLedger getConsensusLedger1 started"; - app.getInboundLedgers().acquireAsync( - id, 0, InboundLedger::Reason::CONSENSUS); + [id = hash, &app = app_, this, journal = j_]() { + perf::measureDurationAndLog( + [&]() { + JLOG(j_.debug()) << "JOB advanceLedger " + "getConsensusLedger1 started"; + app.getInboundLedgers().acquireAsync( + id, 0, InboundLedger::Reason::CONSENSUS); + }, + "getConsensusLedger1", + 1s, + journal); }); } return std::nullopt; @@ -442,21 +451,27 @@ RCLConsensus::Adaptor::onAccept( app_.getJobQueue().addJob( jtACCEPT, "acceptLedger", - [=, this, cj = std::move(consensusJson)]() mutable { - // Note that no lock is held or acquired during this job. - // This is because generic Consensus guarantees that once a ledger - // is accepted, the consensus results and capture by reference state - // will not change until startRound is called (which happens via - // endConsensus). - RclConsensusLogger clog("onAccept", validating, j_); - this->doAccept( - result, - prevLedger, - closeResolution, - rawCloseTimes, - mode, - std::move(cj)); - this->app_.getOPs().endConsensus(clog.ss()); + [=, this, cj = std::move(consensusJson), journal = j_]() mutable { + perf::measureDurationAndLog( + [&]() { + // Note that no lock is held or acquired during this job. + // This is because generic Consensus guarantees that once a + // ledger is accepted, the consensus results and capture by + // reference state will not change until startRound is + // called (which happens via endConsensus). + RclConsensusLogger clog("onAccept", validating, j_); + this->doAccept( + result, + prevLedger, + closeResolution, + rawCloseTimes, + mode, + std::move(cj)); + this->app_.getOPs().endConsensus(clog.ss()); + }, + "acceptLedger", + 1s, + journal); }); } diff --git a/src/xrpld/app/consensus/RCLValidations.cpp b/src/xrpld/app/consensus/RCLValidations.cpp index a04047c78a..e30fbd088f 100644 --- a/src/xrpld/app/consensus/RCLValidations.cpp +++ b/src/xrpld/app/consensus/RCLValidations.cpp @@ -32,6 +32,8 @@ #include +using namespace std::chrono_literals; + namespace ripple { RCLValidatedLedger::RCLValidatedLedger(MakeGenesis) @@ -142,11 +144,19 @@ RCLValidationsAdaptor::acquire(LedgerHash const& hash) Application* pApp = &app_; app_.getJobQueue().addJob( - jtADVANCE, "getConsensusLedger2", [pApp, hash, this]() { - JLOG(j_.debug()) - << "JOB advanceLedger getConsensusLedger2 started"; - pApp->getInboundLedgers().acquireAsync( - hash, 0, InboundLedger::Reason::CONSENSUS); + jtADVANCE, + "getConsensusLedger2", + [pApp, hash, this, journal = j_]() { + perf::measureDurationAndLog( + [&]() { + JLOG(j_.debug()) + << "JOB advanceLedger getConsensusLedger2 started"; + pApp->getInboundLedgers().acquireAsync( + hash, 0, InboundLedger::Reason::CONSENSUS); + }, + "getConsensusLedger2", + 1s, + journal); }); return std::nullopt; } diff --git a/src/xrpld/app/ledger/ConsensusTransSetSF.cpp b/src/xrpld/app/ledger/ConsensusTransSetSF.cpp index e62426b720..1edf49868b 100644 --- a/src/xrpld/app/ledger/ConsensusTransSetSF.cpp +++ b/src/xrpld/app/ledger/ConsensusTransSetSF.cpp @@ -23,11 +23,14 @@ #include #include #include +#include #include #include #include +using namespace std::chrono_literals; + namespace ripple { ConsensusTransSetSF::ConsensusTransSetSF(Application& app, NodeCache& nodeCache) @@ -65,9 +68,14 @@ ConsensusTransSetSF::gotNode( "ripple::ConsensusTransSetSF::gotNode : transaction hash " "match"); auto const pap = &app_; - app_.getJobQueue().addJob(jtTRANSACTION, "TXS->TXN", [pap, stx]() { - pap->getOPs().submitTransaction(stx); - }); + app_.getJobQueue().addJob( + jtTRANSACTION, "TXS->TXN", [pap, stx, journal = j_]() { + perf::measureDurationAndLog( + [&]() { pap->getOPs().submitTransaction(stx); }, + "TXS->TXN", + 1s, + journal); + }); } catch (std::exception const& ex) { diff --git a/src/xrpld/app/ledger/Ledger.cpp b/src/xrpld/app/ledger/Ledger.cpp index 3cdf0ab1a7..deb0655dce 100644 --- a/src/xrpld/app/ledger/Ledger.cpp +++ b/src/xrpld/app/ledger/Ledger.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -46,6 +47,8 @@ #include #include +using namespace std::chrono_literals; + namespace ripple { create_genesis_t const create_genesis{}; @@ -1028,7 +1031,12 @@ pendSaveValidated( isCurrent ? jtPUBLEDGER : jtPUBOLDLEDGER, std::to_string(ledger->seq()), [&app, ledger, isCurrent]() { - saveValidatedLedger(app, ledger, isCurrent); + beast::Journal journal = app.journal("Ledger"); + perf::measureDurationAndLog( + [&]() { saveValidatedLedger(app, ledger, isCurrent); }, + "OrderBookDB::update:", + 1s, + journal); })) { return true;