@@ -1362,47 +1362,33 @@ LedgerManagerImpl::recordTxSubmission(Hash const& contentsHash)
13621362}
13631363
13641364void
1365- LedgerManagerImpl::recordTxMetaEmissionLatency (LedgerCloseMeta const & lcm )
1365+ LedgerManagerImpl::recordTxE2eLatency (ApplicableTxSetFrame const & txSet )
13661366{
13671367 if (!mApp .getConfig ().LOADGEN_MEASURE_TX_E2E_LATENCY_FOR_TESTING )
13681368 {
13691369 return ;
13701370 }
1371- VirtualClock::time_point const emitTime = mApp .getClock ().now ();
1371+ VirtualClock::time_point const applyEndTime = mApp .getClock ().now ();
13721372 MutexLocker guard (mTxLatencyMetrics .mMutex );
1373- auto probe =
1374- [&](auto const & txProcessing) REQUIRES (mTxLatencyMetrics .mMutex ) {
1375- for (auto const & txp : txProcessing)
1373+ for (auto const & phase : txSet.getPhases ())
1374+ {
1375+ for (auto const & tx : phase)
1376+ {
1377+ if (auto submitted = mTxLatencyMetrics .mTxSubmitTimes .find (
1378+ tx->getContentsHash ());
1379+ submitted != mTxLatencyMetrics .mTxSubmitTimes .end ())
13761380 {
1377- if (auto submitted = mTxLatencyMetrics .mTxSubmitTimes .find (
1378- txp.result .transactionHash );
1379- submitted != mTxLatencyMetrics .mTxSubmitTimes .end ())
1380- {
1381- auto const latency = emitTime - submitted->second ;
1382- mTxLatencyMetrics .mTxsExternalized .inc ();
1383- int64_t const ms =
1384- std::chrono::duration_cast<std::chrono::milliseconds>(
1385- latency)
1386- .count ();
1387- mTxLatencyMetrics .mSamples .push_back (std::clamp<int64_t >(
1388- ms, 0 , std::numeric_limits<uint32_t >::max ()));
1389- mTxLatencyMetrics .mTxSubmitTimes .erase (submitted);
1390- }
1381+ auto const latency = applyEndTime - submitted->second ;
1382+ mTxLatencyMetrics .mTxsExternalized .inc ();
1383+ int64_t const ms =
1384+ std::chrono::duration_cast<std::chrono::milliseconds>(
1385+ latency)
1386+ .count ();
1387+ mTxLatencyMetrics .mSamples .push_back (std::clamp<int64_t >(
1388+ ms, 0 , std::numeric_limits<uint32_t >::max ()));
1389+ mTxLatencyMetrics .mTxSubmitTimes .erase (submitted);
13911390 }
1392- };
1393- switch (lcm.v ())
1394- {
1395- case 0 :
1396- probe (lcm.v0 ().txProcessing );
1397- break ;
1398- case 1 :
1399- probe (lcm.v1 ().txProcessing );
1400- break ;
1401- case 2 :
1402- probe (lcm.v2 ().txProcessing );
1403- break ;
1404- default :
1405- releaseAssert (false );
1391+ }
14061392 }
14071393}
14081394
@@ -1941,7 +1927,6 @@ LedgerManagerImpl::applyLedger(LedgerCloseData const& ledgerData,
19411927 appliedLedgerState->getLastClosedLedgerHeader ();
19421928 // Copy this before we move it into mNextMetaToEmit below
19431929 mLastLedgerCloseMeta = *ledgerCloseMeta;
1944- recordTxMetaEmissionLatency (ledgerCloseMeta->getXDR ());
19451930 }
19461931#endif
19471932
@@ -2046,6 +2031,7 @@ LedgerManagerImpl::applyLedger(LedgerCloseData const& ledgerData,
20462031#ifdef BUILD_TESTS
20472032 maybeSimulateSleep (mApp .getConfig (), txSet->sizeOpTotalForLogging (),
20482033 applyLedgerTime, mApplySleepRng );
2034+ recordTxE2eLatency (*applicableTxSet);
20492035#endif
20502036
20512037 // Steps 6, 7, 8 are done in `advanceLedgerStateAndPublish`
0 commit comments