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 it =
txs.find(tx.id());
218 if (it !=
txs.end() && !it->second.accepted)
234 auto 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; });
323 template <
class T,
class Tag>
336 log <<
"tag" <<
"," <<
"txNumSubmitted" <<
"," <<
"txNumAccepted"
337 <<
"," <<
"txNumValidated" <<
"," <<
"txNumOrphaned" <<
","
338 <<
"txUnvalidated" <<
"," <<
"txRateSumbitted" <<
","
339 <<
"txRateAccepted" <<
"," <<
"txRateValidated" <<
","
340 <<
"txLatencySubmitToAccept10Pctl" <<
","
341 <<
"txLatencySubmitToAccept50Pctl" <<
","
342 <<
"txLatencySubmitToAccept90Pctl" <<
","
343 <<
"txLatencySubmitToValidatet10Pctl" <<
","
344 <<
"txLatencySubmitToValidatet50Pctl" <<
","
345 <<
"txLatencySubmitToValidatet90Pctl" <<
std::endl;
456 auto& tracker = it->second;
458 if (!tracker.fullyValidated)
461 tracker.fullyValidated = when;
467 auto& parentTracker = parentIt->second;
468 if (parentTracker.fullyValidated)
481 return !it.second.fullyValidated;
535 template <
class T,
class Tag>
548 log <<
"tag" <<
"," <<
"ledgerNumAccepted" <<
","
549 <<
"ledgerNumFullyValidated" <<
"," <<
"ledgerRateAccepted"
550 <<
"," <<
"ledgerRateFullyValidated" <<
","
551 <<
"ledgerLatencyAcceptToAccept10Pctl" <<
","
552 <<
"ledgerLatencyAcceptToAccept50Pctl" <<
","
553 <<
"ledgerLatencyAcceptToAccept90Pctl" <<
","
554 <<
"ledgerLatencyFullyValidToFullyValid10Pctl" <<
","
555 <<
"ledgerLatencyFullyValidToFullyValid50Pctl" <<
","
556 <<
"ledgerLatencyFullyValidToFullyValid90Pctl" <<
std::endl;
613 out << when.time_since_epoch().count() <<
": Node " << who <<
" accepted " <<
"L"
620 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 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)
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)