3#include <xrpl/basics/UnorderedContainers.h>
5#include <csf/Histogram.h>
6#include <csf/SimTime.h>
8#include <csf/Validation.h>
48 template <
class C,
class E>
59 (...,
apply(std::get<Is>(cs), who, when, e));
99template <
class CollectorType>
119 byNode[who].on(who, when, e);
217 auto const it =
txs.find(tx.id());
218 if (it !=
txs.end() && !it->second.accepted)
234 auto const it =
txs.find(tx.id());
235 if (it !=
txs.end() && !it->second.validated)
253 txs.begin(),
txs.end(), [](
auto const& it) { return !it.second.accepted; });
261 txs.begin(),
txs.end(), [](
auto const& it) { return !it.second.validated; });
325 template <
class T,
class Tag>
340 log <<
"tag" <<
"," <<
"txNumSubmitted" <<
"," <<
"txNumAccepted"
341 <<
"," <<
"txNumValidated" <<
"," <<
"txNumOrphaned" <<
","
342 <<
"txUnvalidated" <<
"," <<
"txRateSumbitted" <<
","
343 <<
"txRateAccepted" <<
"," <<
"txRateValidated" <<
","
344 <<
"txLatencySubmitToAccept10Pctl" <<
","
345 <<
"txLatencySubmitToAccept50Pctl" <<
","
346 <<
"txLatencySubmitToAccept90Pctl" <<
","
347 <<
"txLatencySubmitToValidatet10Pctl" <<
","
348 <<
"txLatencySubmitToValidatet50Pctl" <<
","
349 <<
"txLatencySubmitToValidatet90Pctl" <<
std::endl;
460 auto& tracker = it->second;
462 if (!tracker.fullyValidated)
465 tracker.fullyValidated = when;
471 auto& parentTracker = parentIt->second;
472 if (parentTracker.fullyValidated)
485 return !it.second.fullyValidated;
541 template <
class T,
class Tag>
556 log <<
"tag" <<
"," <<
"ledgerNumAccepted" <<
","
557 <<
"ledgerNumFullyValidated" <<
"," <<
"ledgerRateAccepted"
558 <<
"," <<
"ledgerRateFullyValidated" <<
","
559 <<
"ledgerLatencyAcceptToAccept10Pctl" <<
","
560 <<
"ledgerLatencyAcceptToAccept50Pctl" <<
","
561 <<
"ledgerLatencyAcceptToAccept90Pctl" <<
","
562 <<
"ledgerLatencyFullyValidToFullyValid10Pctl" <<
","
563 <<
"ledgerLatencyFullyValidToFullyValid50Pctl" <<
","
564 <<
"ledgerLatencyFullyValidToFullyValid90Pctl" <<
std::endl;
621 out << when.time_since_epoch().count() <<
": Node " << who <<
" accepted " <<
"L"
628 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 > HashMap
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 prior
The prior fully validated ledger This is a jump if prior.id() != ledger.parentID().
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)
HashMap< 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
void on(PeerID who, SimTime when, SubmitTx const &e)
HashMap< Tx::ID, Tracker > txs
void csv(SimDuration simDuration, T &log, Tag const &tag, bool printHeaders=false)