3#include <test/csf/Histogram.h>
4#include <test/csf/SimTime.h>
5#include <test/csf/events.h>
7#include <xrpl/basics/UnorderedContainers.h>
37 template <
class C,
class E>
48 (...,
apply(std::get<Is>(cs), who, when, e));
84template <
class CollectorType>
104 byNode[who].on(who, when, e);
197 auto it =
txs.find(tx.id());
198 if (it !=
txs.end() && !it->second.accepted)
214 auto it =
txs.find(tx.id());
215 if (it !=
txs.end() && !it->second.validated)
233 txs.begin(),
txs.end(), [](
auto const& it) { return !it.second.accepted; });
241 txs.begin(),
txs.end(), [](
auto const& it) { return !it.second.validated; });
303 template <
class T,
class Tag>
316 log <<
"tag" <<
"," <<
"txNumSubmitted" <<
"," <<
"txNumAccepted"
317 <<
"," <<
"txNumValidated" <<
"," <<
"txNumOrphaned" <<
","
318 <<
"txUnvalidated" <<
"," <<
"txRateSumbitted" <<
","
319 <<
"txRateAccepted" <<
"," <<
"txRateValidated" <<
","
320 <<
"txLatencySubmitToAccept10Pctl" <<
","
321 <<
"txLatencySubmitToAccept50Pctl" <<
","
322 <<
"txLatencySubmitToAccept90Pctl" <<
","
323 <<
"txLatencySubmitToValidatet10Pctl" <<
","
324 <<
"txLatencySubmitToValidatet50Pctl" <<
","
325 <<
"txLatencySubmitToValidatet90Pctl" <<
std::endl;
436 auto& tracker = it->second;
438 if (!tracker.fullyValidated)
441 tracker.fullyValidated = when;
447 auto& parentTracker = parentIt->second;
448 if (parentTracker.fullyValidated)
461 return !it.second.fullyValidated;
515 template <
class T,
class Tag>
528 log <<
"tag" <<
"," <<
"ledgerNumAccepted" <<
","
529 <<
"ledgerNumFullyValidated" <<
"," <<
"ledgerRateAccepted"
530 <<
"," <<
"ledgerRateFullyValidated" <<
","
531 <<
"ledgerLatencyAcceptToAccept10Pctl" <<
","
532 <<
"ledgerLatencyAcceptToAccept50Pctl" <<
","
533 <<
"ledgerLatencyAcceptToAccept90Pctl" <<
","
534 <<
"ledgerLatencyFullyValidToFullyValid10Pctl" <<
","
535 <<
"ledgerLatencyFullyValidToFullyValid50Pctl" <<
","
536 <<
"ledgerLatencyFullyValidToFullyValid90Pctl" <<
std::endl;
592 out << when.time_since_epoch().count() <<
": Node " << who <<
" accepted " <<
"L"
599 out << when.time_since_epoch().count() <<
": Node " << who <<
" fully-validated " <<
"L"
static void apply(std::tuple< Cs &... > &cs, PeerID who, SimTime when, E e, std::index_sequence< Is... >)
void on(PeerID who, SimTime when, E e)
std::tuple< Cs &... > cs_
Collectors(Cs &... cs)
Constructor.
static void apply(C &c, PeerID who, SimTime when, E e)
A ledger is a set of observed transactions and a sequence number identifying the ledger.
TxSetType const & txs() const
T duration_cast(T... args)
SimClock::duration SimDuration
TaggedInteger< std::uint32_t, PeerIDTag > PeerID
SimClock::time_point SimTime
Collectors< Cs... > makeCollectors(Cs &... cs)
Create an instance of Collectors<Cs...>.
std::unordered_map< Key, Value, Hash, Pred, Allocator > hash_map
T setprecision(T... args)
Peer accepted consensus results.
Maintain an instance of a Collector per peer.
CollectorType const & operator[](PeerID who) const
void on(PeerID who, SimTime when, E const &e)
std::map< PeerID, CollectorType > byNode
CollectorType & operator[](PeerID who)
Peer fully validated a new ledger.
Ledger ledger
The new fully validated ledger.
Saves information about Jumps for closed and fully validated ledgers.
std::vector< Jump > fullyValidatedJumps
void on(PeerID, SimTime, E const &e)
void on(PeerID who, SimTime when, FullyValidateLedger const &e)
void on(PeerID who, SimTime when, AcceptLedger const &e)
std::vector< Jump > closeJumps
Tracker(SimTime accepted)
std::optional< SimTime > fullyValidated
Tracks the accepted -> validated evolution of ledgers.
void on(PeerID who, SimTime when, AcceptLedger const &e)
hash_map< Ledger::ID, Tracker > ledgers
void csv(SimDuration simDuration, T &log, Tag const &tag, bool printHeaders=false)
void on(PeerID, SimTime, E const &e)
std::size_t fullyValidated
Hist fullyValidToFullyValid
void on(PeerID who, SimTime when, FullyValidateLedger const &e)
void report(SimDuration simDuration, T &log, bool printBreakline=false)
Histogram< SimTime::duration > Hist
std::size_t unvalidated() const
Collector which ignores all events.
void on(PeerID, SimTime, E const &e)
Tracks the overall duration of a simulation.
void on(PeerID, SimTime when, E const &e)
Write out stream of ledger activity.
void on(PeerID, SimTime, E const &e)
void on(PeerID who, SimTime when, FullyValidateLedger const &e)
void on(PeerID who, SimTime when, AcceptLedger const &e)
A transaction submitted to a peer.
Tx tx
The submitted transaction.
std::optional< SimTime > accepted
std::optional< SimTime > validated
Tracker(Tx tx, SimTime submitted)
Tracks the submission -> accepted -> validated evolution of transactions.
void report(SimDuration simDuration, T &log, bool printBreakline=false)
void on(PeerID who, SimTime when, AcceptLedger const &e)
std::size_t orphaned() const
void on(PeerID who, SimTime when, FullyValidateLedger const &e)
std::size_t unvalidated() const
void on(PeerID, SimTime when, E const &e)
Histogram< SimTime::duration > Hist
hash_map< Tx::ID, Tracker > txs
void on(PeerID who, SimTime when, SubmitTx const &e)
void csv(SimDuration simDuration, T &log, Tag const &tag, bool printHeaders=false)