rippled
collectors.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012-2017 Ripple Labs Inc
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 #ifndef RIPPLE_TEST_CSF_COLLECTORS_H_INCLUDED
20 #define RIPPLE_TEST_CSF_COLLECTORS_H_INCLUDED
21 
22 #include <ripple/basics/UnorderedContainers.h>
23 #include <test/csf/Histogram.h>
24 #include <test/csf/SimTime.h>
25 #include <test/csf/events.h>
26 
27 #include <chrono>
28 #include <optional>
29 #include <ostream>
30 #include <tuple>
31 
32 namespace ripple {
33 namespace test {
34 namespace csf {
35 
36 // A collector is any class that implements
37 //
38 // on(NodeID, SimTime, Event)
39 //
40 // for all events emitted by a Peer.
41 //
42 // This file contains helper functions for composing different collectors
43 // and also defines several standard collectors available for simulations.
44 
52 template <class... Cs>
54 {
55  std::tuple<Cs&...> cs;
56 
57  template <class C, class E>
58  static void
59  apply(C& c, PeerID who, SimTime when, E e)
60  {
61  c.on(who, when, e);
62  }
63 
64  template <std::size_t... Is, class E>
65  static void
68  PeerID who,
69  SimTime when,
70  E e,
72  {
73  (..., apply(std::get<Is>(cs), who, when, e));
74  }
75 
76 public:
81  Collectors(Cs&... cs_) : cs(std::tie(cs_...))
82  {
83  }
84 
85  template <class E>
86  void
87  on(PeerID who, SimTime when, E e)
88  {
89  apply(cs, who, when, e, std::index_sequence_for<Cs...>{});
90  }
91 };
92 
94 template <class... Cs>
95 Collectors<Cs...>
96 makeCollectors(Cs&... cs)
97 {
98  return Collectors<Cs...>(cs...);
99 }
100 
109 template <class CollectorType>
111 {
113 
114  CollectorType&
116  {
117  return byNode[who];
118  }
119 
120  CollectorType const&
121  operator[](PeerID who) const
122  {
123  return byNode[who];
124  }
125  template <class E>
126  void
127  on(PeerID who, SimTime when, E const& e)
128  {
129  byNode[who].on(who, when, e);
130  }
131 };
132 
135 {
136  template <class E>
137  void
138  on(PeerID, SimTime, E const& e)
139  {
140  }
141 };
142 
145 {
146  bool init = false;
149 
150  template <class E>
151  void
152  on(PeerID, SimTime when, E const& e)
153  {
154  if (!init)
155  {
156  start = when;
157  init = true;
158  }
159  else
160  stop = when;
161  }
162 };
163 
174 {
175  // Counts
179 
180  struct Tracker
181  {
186 
187  Tracker(Tx tx_, SimTime submitted_) : tx{tx_}, submitted{submitted_}
188  {
189  }
190  };
191 
193 
197 
198  // Ignore most events by default
199  template <class E>
200  void
201  on(PeerID, SimTime when, E const& e)
202  {
203  }
204 
205  void
206  on(PeerID who, SimTime when, SubmitTx const& e)
207  {
208  // save first time it was seen
209  if (txs.emplace(e.tx.id(), Tracker{e.tx, when}).second)
210  {
211  submitted++;
212  }
213  }
214 
215  void
216  on(PeerID who, SimTime when, AcceptLedger const& e)
217  {
218  for (auto const& tx : e.ledger.txs())
219  {
220  auto it = txs.find(tx.id());
221  if (it != txs.end() && !it->second.accepted)
222  {
223  Tracker& tracker = it->second;
224  tracker.accepted = when;
225  accepted++;
226 
227  submitToAccept.insert(*tracker.accepted - tracker.submitted);
228  }
229  }
230  }
231 
232  void
233  on(PeerID who, SimTime when, FullyValidateLedger const& e)
234  {
235  for (auto const& tx : e.ledger.txs())
236  {
237  auto it = txs.find(tx.id());
238  if (it != txs.end() && !it->second.validated)
239  {
240  Tracker& tracker = it->second;
241  // Should only validated a previously accepted Tx
242  assert(tracker.accepted);
243 
244  tracker.validated = when;
245  validated++;
246  submitToValidate.insert(*tracker.validated - tracker.submitted);
247  }
248  }
249  }
250 
251  // Returns the number of txs which were never accepted
253  orphaned() const
254  {
255  return std::count_if(txs.begin(), txs.end(), [](auto const& it) {
256  return !it.second.accepted;
257  });
258  }
259 
260  // Returns the number of txs which were never validated
262  unvalidated() const
263  {
264  return std::count_if(txs.begin(), txs.end(), [](auto const& it) {
265  return !it.second.validated;
266  });
267  }
268 
269  template <class T>
270  void
271  report(SimDuration simDuration, T& log, bool printBreakline = false)
272  {
273  using namespace std::chrono;
274  auto perSec = [&simDuration](std::size_t count) {
275  return double(count) / duration_cast<seconds>(simDuration).count();
276  };
277 
278  auto fmtS = [](SimDuration dur) {
279  return duration_cast<duration<float>>(dur).count();
280  };
281 
282  if (printBreakline)
283  {
284  log << std::setw(11) << std::setfill('-') << "-"
285  << "-" << std::setw(7) << std::setfill('-') << "-"
286  << "-" << std::setw(7) << std::setfill('-') << "-"
287  << "-" << std::setw(36) << std::setfill('-') << "-"
288  << std::endl;
289  log << std::setfill(' ');
290  }
291 
292  log << std::left << std::setw(11) << "TxStats"
293  << "|" << std::setw(7) << "Count"
294  << "|" << std::setw(7) << "Per Sec"
295  << "|" << std::setw(15) << "Latency (sec)" << std::right
296  << std::setw(7) << "10-ile" << std::setw(7) << "50-ile"
297  << std::setw(7) << "90-ile" << std::left << std::endl;
298 
299  log << std::setw(11) << std::setfill('-') << "-"
300  << "|" << std::setw(7) << std::setfill('-') << "-"
301  << "|" << std::setw(7) << std::setfill('-') << "-"
302  << "|" << std::setw(36) << std::setfill('-') << "-" << std::endl;
303  log << std::setfill(' ');
304 
305  log << std::left << std::setw(11) << "Submit "
306  << "|" << std::right << std::setw(7) << submitted << "|"
307  << std::setw(7) << std::setprecision(2) << perSec(submitted) << "|"
308  << std::setw(36) << "" << std::endl;
309 
310  log << std::left << std::setw(11) << "Accept "
311  << "|" << std::right << std::setw(7) << accepted << "|"
312  << std::setw(7) << std::setprecision(2) << perSec(accepted) << "|"
313  << std::setw(15) << std::left << "From Submit" << std::right
314  << std::setw(7) << std::setprecision(2)
315  << fmtS(submitToAccept.percentile(0.1f)) << std::setw(7)
316  << std::setprecision(2) << fmtS(submitToAccept.percentile(0.5f))
317  << std::setw(7) << std::setprecision(2)
318  << fmtS(submitToAccept.percentile(0.9f)) << std::endl;
319 
320  log << std::left << std::setw(11) << "Validate "
321  << "|" << std::right << std::setw(7) << validated << "|"
322  << std::setw(7) << std::setprecision(2) << perSec(validated) << "|"
323  << std::setw(15) << std::left << "From Submit" << std::right
324  << std::setw(7) << std::setprecision(2)
325  << fmtS(submitToValidate.percentile(0.1f)) << std::setw(7)
326  << std::setprecision(2) << fmtS(submitToValidate.percentile(0.5f))
327  << std::setw(7) << std::setprecision(2)
328  << fmtS(submitToValidate.percentile(0.9f)) << std::endl;
329 
330  log << std::left << std::setw(11) << "Orphan"
331  << "|" << std::right << std::setw(7) << orphaned() << "|"
332  << std::setw(7) << ""
333  << "|" << std::setw(36) << std::endl;
334 
335  log << std::left << std::setw(11) << "Unvalidated"
336  << "|" << std::right << std::setw(7) << unvalidated() << "|"
337  << std::setw(7) << ""
338  << "|" << std::setw(43) << std::endl;
339 
340  log << std::setw(11) << std::setfill('-') << "-"
341  << "-" << std::setw(7) << std::setfill('-') << "-"
342  << "-" << std::setw(7) << std::setfill('-') << "-"
343  << "-" << std::setw(36) << std::setfill('-') << "-" << std::endl;
344  log << std::setfill(' ');
345  }
346 
347  template <class T, class Tag>
348  void
349  csv(SimDuration simDuration,
350  T& log,
351  Tag const& tag,
352  bool printHeaders = false)
353  {
354  using namespace std::chrono;
355  auto perSec = [&simDuration](std::size_t count) {
356  return double(count) / duration_cast<seconds>(simDuration).count();
357  };
358 
359  auto fmtS = [](SimDuration dur) {
360  return duration_cast<duration<float>>(dur).count();
361  };
362 
363  if (printHeaders)
364  {
365  log << "tag"
366  << ","
367  << "txNumSubmitted"
368  << ","
369  << "txNumAccepted"
370  << ","
371  << "txNumValidated"
372  << ","
373  << "txNumOrphaned"
374  << ","
375  << "txUnvalidated"
376  << ","
377  << "txRateSumbitted"
378  << ","
379  << "txRateAccepted"
380  << ","
381  << "txRateValidated"
382  << ","
383  << "txLatencySubmitToAccept10Pctl"
384  << ","
385  << "txLatencySubmitToAccept50Pctl"
386  << ","
387  << "txLatencySubmitToAccept90Pctl"
388  << ","
389  << "txLatencySubmitToValidatet10Pctl"
390  << ","
391  << "txLatencySubmitToValidatet50Pctl"
392  << ","
393  << "txLatencySubmitToValidatet90Pctl" << std::endl;
394  }
395 
396  log << tag
397  << ","
398  // txNumSubmitted
399  << submitted
400  << ","
401  // txNumAccepted
402  << accepted
403  << ","
404  // txNumValidated
405  << validated
406  << ","
407  // txNumOrphaned
408  << orphaned()
409  << ","
410  // txNumUnvalidated
411  << unvalidated()
412  << ","
413  // txRateSubmitted
414  << std::setprecision(2) << perSec(submitted)
415  << ","
416  // txRateAccepted
417  << std::setprecision(2) << perSec(accepted)
418  << ","
419  // txRateValidated
420  << std::setprecision(2) << perSec(validated)
421  << ","
422  // txLatencySubmitToAccept10Pctl
423  << std::setprecision(2) << fmtS(submitToAccept.percentile(0.1f))
424  << ","
425  // txLatencySubmitToAccept50Pctl
426  << std::setprecision(2) << fmtS(submitToAccept.percentile(0.5f))
427  << ","
428  // txLatencySubmitToAccept90Pctl
429  << std::setprecision(2) << fmtS(submitToAccept.percentile(0.9f))
430  << ","
431  // txLatencySubmitToValidate10Pctl
432  << std::setprecision(2) << fmtS(submitToValidate.percentile(0.1f))
433  << ","
434  // txLatencySubmitToValidate50Pctl
435  << std::setprecision(2) << fmtS(submitToValidate.percentile(0.5f))
436  << ","
437  // txLatencySubmitToValidate90Pctl
438  << std::setprecision(2) << fmtS(submitToValidate.percentile(0.9f))
439  << "," << std::endl;
440  }
441 };
442 
450 {
452  std::size_t fullyValidated{0};
453 
454  struct Tracker
455  {
458 
459  Tracker(SimTime accepted_) : accepted{accepted_}
460  {
461  }
462  };
463 
465 
470 
471  // Ignore most events by default
472  template <class E>
473  void
474  on(PeerID, SimTime, E const& e)
475  {
476  }
477 
478  void
479  on(PeerID who, SimTime when, AcceptLedger const& e)
480  {
481  // First time this ledger accepted
482  if (ledgers_.emplace(e.ledger.id(), Tracker{when}).second)
483  {
484  ++accepted;
485  // ignore jumps?
486  if (e.prior.id() == e.ledger.parentID())
487  {
488  auto const it = ledgers_.find(e.ledger.parentID());
489  if (it != ledgers_.end())
490  {
491  acceptToAccept.insert(when - it->second.accepted);
492  }
493  }
494  }
495  }
496 
497  void
498  on(PeerID who, SimTime when, FullyValidateLedger const& e)
499  {
500  // ignore jumps
501  if (e.prior.id() == e.ledger.parentID())
502  {
503  auto const it = ledgers_.find(e.ledger.id());
504  assert(it != ledgers_.end());
505  auto& tracker = it->second;
506  // first time fully validated
507  if (!tracker.fullyValidated)
508  {
509  ++fullyValidated;
510  tracker.fullyValidated = when;
511  acceptToFullyValid.insert(when - tracker.accepted);
512 
513  auto const parentIt = ledgers_.find(e.ledger.parentID());
514  if (parentIt != ledgers_.end())
515  {
516  auto& parentTracker = parentIt->second;
517  if (parentTracker.fullyValidated)
518  {
519  fullyValidToFullyValid.insert(
520  when - *parentTracker.fullyValidated);
521  }
522  }
523  }
524  }
525  }
526 
528  unvalidated() const
529  {
530  return std::count_if(
531  ledgers_.begin(), ledgers_.end(), [](auto const& it) {
532  return !it.second.fullyValidated;
533  });
534  }
535 
536  template <class T>
537  void
538  report(SimDuration simDuration, T& log, bool printBreakline = false)
539  {
540  using namespace std::chrono;
541  auto perSec = [&simDuration](std::size_t count) {
542  return double(count) / duration_cast<seconds>(simDuration).count();
543  };
544 
545  auto fmtS = [](SimDuration dur) {
546  return duration_cast<duration<float>>(dur).count();
547  };
548 
549  if (printBreakline)
550  {
551  log << std::setw(11) << std::setfill('-') << "-"
552  << "-" << std::setw(7) << std::setfill('-') << "-"
553  << "-" << std::setw(7) << std::setfill('-') << "-"
554  << "-" << std::setw(36) << std::setfill('-') << "-"
555  << std::endl;
556  log << std::setfill(' ');
557  }
558 
559  log << std::left << std::setw(11) << "LedgerStats"
560  << "|" << std::setw(7) << "Count"
561  << "|" << std::setw(7) << "Per Sec"
562  << "|" << std::setw(15) << "Latency (sec)" << std::right
563  << std::setw(7) << "10-ile" << std::setw(7) << "50-ile"
564  << std::setw(7) << "90-ile" << std::left << std::endl;
565 
566  log << std::setw(11) << std::setfill('-') << "-"
567  << "|" << std::setw(7) << std::setfill('-') << "-"
568  << "|" << std::setw(7) << std::setfill('-') << "-"
569  << "|" << std::setw(36) << std::setfill('-') << "-" << std::endl;
570  log << std::setfill(' ');
571 
572  log << std::left << std::setw(11) << "Accept "
573  << "|" << std::right << std::setw(7) << accepted << "|"
574  << std::setw(7) << std::setprecision(2) << perSec(accepted) << "|"
575  << std::setw(15) << std::left << "From Accept" << std::right
576  << std::setw(7) << std::setprecision(2)
577  << fmtS(acceptToAccept.percentile(0.1f)) << std::setw(7)
578  << std::setprecision(2) << fmtS(acceptToAccept.percentile(0.5f))
579  << std::setw(7) << std::setprecision(2)
580  << fmtS(acceptToAccept.percentile(0.9f)) << std::endl;
581 
582  log << std::left << std::setw(11) << "Validate "
583  << "|" << std::right << std::setw(7) << fullyValidated << "|"
584  << std::setw(7) << std::setprecision(2) << perSec(fullyValidated)
585  << "|" << std::setw(15) << std::left << "From Validate "
586  << std::right << std::setw(7) << std::setprecision(2)
587  << fmtS(fullyValidToFullyValid.percentile(0.1f)) << std::setw(7)
588  << std::setprecision(2)
589  << fmtS(fullyValidToFullyValid.percentile(0.5f)) << std::setw(7)
590  << std::setprecision(2)
591  << fmtS(fullyValidToFullyValid.percentile(0.9f)) << std::endl;
592 
593  log << std::setw(11) << std::setfill('-') << "-"
594  << "-" << std::setw(7) << std::setfill('-') << "-"
595  << "-" << std::setw(7) << std::setfill('-') << "-"
596  << "-" << std::setw(36) << std::setfill('-') << "-" << std::endl;
597  log << std::setfill(' ');
598  }
599 
600  template <class T, class Tag>
601  void
602  csv(SimDuration simDuration,
603  T& log,
604  Tag const& tag,
605  bool printHeaders = false)
606  {
607  using namespace std::chrono;
608  auto perSec = [&simDuration](std::size_t count) {
609  return double(count) / duration_cast<seconds>(simDuration).count();
610  };
611 
612  auto fmtS = [](SimDuration dur) {
613  return duration_cast<duration<float>>(dur).count();
614  };
615 
616  if (printHeaders)
617  {
618  log << "tag"
619  << ","
620  << "ledgerNumAccepted"
621  << ","
622  << "ledgerNumFullyValidated"
623  << ","
624  << "ledgerRateAccepted"
625  << ","
626  << "ledgerRateFullyValidated"
627  << ","
628  << "ledgerLatencyAcceptToAccept10Pctl"
629  << ","
630  << "ledgerLatencyAcceptToAccept50Pctl"
631  << ","
632  << "ledgerLatencyAcceptToAccept90Pctl"
633  << ","
634  << "ledgerLatencyFullyValidToFullyValid10Pctl"
635  << ","
636  << "ledgerLatencyFullyValidToFullyValid50Pctl"
637  << ","
638  << "ledgerLatencyFullyValidToFullyValid90Pctl" << std::endl;
639  }
640 
641  log << tag
642  << ","
643  // ledgerNumAccepted
644  << accepted
645  << ","
646  // ledgerNumFullyValidated
647  << fullyValidated
648  << ","
649  // ledgerRateAccepted
650  << std::setprecision(2) << perSec(accepted)
651  << ","
652  // ledgerRateFullyValidated
653  << std::setprecision(2) << perSec(fullyValidated)
654  << ","
655  // ledgerLatencyAcceptToAccept10Pctl
656  << std::setprecision(2) << fmtS(acceptToAccept.percentile(0.1f))
657  << ","
658  // ledgerLatencyAcceptToAccept50Pctl
659  << std::setprecision(2) << fmtS(acceptToAccept.percentile(0.5f))
660  << ","
661  // ledgerLatencyAcceptToAccept90Pctl
662  << std::setprecision(2) << fmtS(acceptToAccept.percentile(0.9f))
663  << ","
664  // ledgerLatencyFullyValidToFullyValid10Pctl
665  << std::setprecision(2)
666  << fmtS(fullyValidToFullyValid.percentile(0.1f))
667  << ","
668  // ledgerLatencyFullyValidToFullyValid50Pctl
669  << std::setprecision(2)
670  << fmtS(fullyValidToFullyValid.percentile(0.5f))
671  << ","
672  // ledgerLatencyFullyValidToFullyValid90Pctl
673  << std::setprecision(2)
674  << fmtS(fullyValidToFullyValid.percentile(0.9f)) << std::endl;
675  }
676 };
677 
684 {
686 
687  // Ignore most events by default
688  template <class E>
689  void
690  on(PeerID, SimTime, E const& e)
691  {
692  }
693 
694  void
695  on(PeerID who, SimTime when, AcceptLedger const& e)
696  {
697  out << when.time_since_epoch().count() << ": Node " << who
698  << " accepted "
699  << "L" << e.ledger.id() << " " << e.ledger.txs() << "\n";
700  }
701 
702  void
703  on(PeerID who, SimTime when, FullyValidateLedger const& e)
704  {
705  out << when.time_since_epoch().count() << ": Node " << who
706  << " fully-validated "
707  << "L" << e.ledger.id() << " " << e.ledger.txs() << "\n";
708  }
709 };
710 
717 {
718  struct Jump
719  {
724  };
725 
728 
729  // Ignore most events by default
730  template <class E>
731  void
732  on(PeerID, SimTime, E const& e)
733  {
734  }
735 
736  void
737  on(PeerID who, SimTime when, AcceptLedger const& e)
738  {
739  // Not a direct child -> parent switch
740  if (e.ledger.parentID() != e.prior.id())
741  closeJumps.emplace_back(Jump{who, when, e.prior, e.ledger});
742  }
743 
744  void
745  on(PeerID who, SimTime when, FullyValidateLedger const& e)
746  {
747  // Not a direct child -> parent switch
748  if (e.ledger.parentID() != e.prior.id())
749  fullyValidatedJumps.emplace_back(
750  Jump{who, when, e.prior, e.ledger});
751  }
752 };
753 
754 } // namespace csf
755 } // namespace test
756 } // namespace ripple
757 
758 #endif
ripple::test::csf::TxCollector::csv
void csv(SimDuration simDuration, T &log, Tag const &tag, bool printHeaders=false)
Definition: collectors.h:349
ripple::test::csf::JumpCollector::Jump::from
Ledger from
Definition: collectors.h:722
ripple::test::csf::SimTime
typename SimClock::time_point SimTime
Definition: SimTime.h:36
std::setprecision
T setprecision(T... args)
ripple::test::csf::Ledger::parentID
ID parentID() const
Definition: ledgers.h:203
ripple::test::csf::LedgerCollector::acceptToFullyValid
Hist acceptToFullyValid
Definition: collectors.h:467
ripple::test::csf::JumpCollector::on
void on(PeerID, SimTime, E const &e)
Definition: collectors.h:732
ripple::test::csf::TxCollector::Tracker::tx
Tx tx
Definition: collectors.h:182
ripple::test::csf::NullCollector
Collector which ignores all events.
Definition: collectors.h:134
ripple::test::csf::JumpCollector
Saves information about Jumps for closed and fully validated ledgers.
Definition: collectors.h:716
ripple::test::csf::JumpCollector::Jump::id
PeerID id
Definition: collectors.h:720
ripple::test::csf::SimDurationCollector::start
SimTime start
Definition: collectors.h:147
ripple::test::csf::CollectByNode::operator[]
CollectorType & operator[](PeerID who)
Definition: collectors.h:115
ripple::test::csf::JumpCollector::fullyValidatedJumps
std::vector< Jump > fullyValidatedJumps
Definition: collectors.h:727
std::index_sequence
ripple::test::csf::JumpCollector::Jump::to
Ledger to
Definition: collectors.h:723
std::vector
STL class.
std::unordered_map::find
T find(T... args)
ripple::test::csf::SimDurationCollector::on
void on(PeerID, SimTime when, E const &e)
Definition: collectors.h:152
ripple::test::csf::LedgerCollector::unvalidated
std::size_t unvalidated() const
Definition: collectors.h:528
ripple::test::csf::Histogram::percentile
T percentile(float p) const
Calculate the given percentile of the distribution.
Definition: Histogram.h:109
ripple::test::csf::LedgerCollector::on
void on(PeerID who, SimTime when, AcceptLedger const &e)
Definition: collectors.h:479
ripple::test::csf::FullyValidateLedger
Peer fully validated a new ledger.
Definition: events.h:137
std::unordered_map::emplace
T emplace(T... args)
ripple::test::csf::Ledger::txs
TxSetType const & txs() const
Definition: ledgers.h:209
ripple::test::csf::FullyValidateLedger::prior
Ledger prior
The prior fully validated ledger This is a jump if prior.id() != ledger.parentID()
Definition: events.h:144
ripple::test::csf::StreamCollector::on
void on(PeerID who, SimTime when, FullyValidateLedger const &e)
Definition: collectors.h:703
tuple
ripple::test::csf::LedgerCollector::csv
void csv(SimDuration simDuration, T &log, Tag const &tag, bool printHeaders=false)
Definition: collectors.h:602
ripple::test::csf::Ledger
A ledger is a set of observed transactions and a sequence number identifying the ledger.
Definition: ledgers.h:58
ripple::test::csf::Collectors::apply
static void apply(C &c, PeerID who, SimTime when, E e)
Definition: collectors.h:59
std::setfill
T setfill(T... args)
ripple::test::csf::LedgerCollector
Tracks the accepted -> validated evolution of ledgers.
Definition: collectors.h:449
ripple::test::csf::TxCollector::on
void on(PeerID who, SimTime when, SubmitTx const &e)
Definition: collectors.h:206
ripple::test::csf::StreamCollector::on
void on(PeerID, SimTime, E const &e)
Definition: collectors.h:690
ripple::test::csf::JumpCollector::on
void on(PeerID who, SimTime when, AcceptLedger const &e)
Definition: collectors.h:737
ripple::test::csf::LedgerCollector::report
void report(SimDuration simDuration, T &log, bool printBreakline=false)
Definition: collectors.h:538
ripple::test::csf::StreamCollector::out
std::ostream & out
Definition: collectors.h:685
ripple::test::csf::Tx::id
ID id() const
Definition: Tx.h:50
ripple::test::csf::FullyValidateLedger::ledger
Ledger ledger
The new fully validated ledger.
Definition: events.h:140
ripple::test::csf::TxCollector::orphaned
std::size_t orphaned() const
Definition: collectors.h:253
ripple::test::csf::SimDurationCollector
Tracks the overall duration of a simulation.
Definition: collectors.h:144
ripple::test::csf::TxCollector::submitToValidate
Hist submitToValidate
Definition: collectors.h:196
ripple::test::csf::SimDurationCollector::stop
SimTime stop
Definition: collectors.h:148
ripple::test::csf::TxCollector::submitToAccept
Hist submitToAccept
Definition: collectors.h:195
ripple::test::csf::TxCollector::Tracker
Definition: collectors.h:180
ripple::test::csf::AcceptLedger
Peer accepted consensus results.
Definition: events.h:118
ripple::test::csf::TxCollector::txs
hash_map< Tx::ID, Tracker > txs
Definition: collectors.h:192
ripple::test::csf::TxCollector
Tracks the submission -> accepted -> validated evolution of transactions.
Definition: collectors.h:173
ripple::test::csf::Histogram::insert
void insert(T const &s)
Insert an sample.
Definition: Histogram.h:52
ripple::test::csf::Collectors::apply
static void apply(std::tuple< Cs &... > &cs, PeerID who, SimTime when, E e, std::index_sequence< Is... >)
Definition: collectors.h:66
ripple::test::csf::TxCollector::unvalidated
std::size_t unvalidated() const
Definition: collectors.h:262
ripple::QualityDirection::out
@ out
ripple::test::csf::CollectByNode::on
void on(PeerID who, SimTime when, E const &e)
Definition: collectors.h:127
ripple::test::csf::LedgerCollector::ledgers_
hash_map< Ledger::ID, Tracker > ledgers_
Definition: collectors.h:464
ripple::test::csf::NullCollector::on
void on(PeerID, SimTime, E const &e)
Definition: collectors.h:138
ripple::test::csf::CollectByNode::byNode
std::map< PeerID, CollectorType > byNode
Definition: collectors.h:112
ripple::test::csf::LedgerCollector::acceptToAccept
Hist acceptToAccept
Definition: collectors.h:468
ripple::test::csf::TxCollector::accepted
std::size_t accepted
Definition: collectors.h:177
std::ostream
STL class.
ripple::test::csf::makeCollectors
Collectors< Cs... > makeCollectors(Cs &... cs)
Create an instance of Collectors<Cs...>
Definition: collectors.h:96
chrono
ripple::test::csf::TxCollector::on
void on(PeerID, SimTime when, E const &e)
Definition: collectors.h:201
ripple::test::csf::Collectors::cs
std::tuple< Cs &... > cs
Definition: collectors.h:55
ripple::test::csf::AcceptLedger::ledger
Ledger ledger
Definition: events.h:121
ripple::test::csf::TxCollector::Tracker::accepted
std::optional< SimTime > accepted
Definition: collectors.h:184
ripple::test::csf::Tx
A single transaction.
Definition: Tx.h:35
ripple::test::csf::SimDurationCollector::init
bool init
Definition: collectors.h:146
ripple::test::csf::TxCollector::on
void on(PeerID who, SimTime when, AcceptLedger const &e)
Definition: collectors.h:216
ripple::test::csf::StreamCollector::on
void on(PeerID who, SimTime when, AcceptLedger const &e)
Definition: collectors.h:695
ripple::test::csf::SubmitTx::tx
Tx tx
The submitted transaction.
Definition: events.h:92
std::map
STL class.
ripple::test::csf::CollectByNode::operator[]
CollectorType const & operator[](PeerID who) const
Definition: collectors.h:121
ripple::test::csf::JumpCollector::closeJumps
std::vector< Jump > closeJumps
Definition: collectors.h:726
ripple::test::csf::LedgerCollector::on
void on(PeerID who, SimTime when, FullyValidateLedger const &e)
Definition: collectors.h:498
ripple::test::csf::TxCollector::on
void on(PeerID who, SimTime when, FullyValidateLedger const &e)
Definition: collectors.h:233
ripple::test::csf::Histogram< SimTime::duration >
ripple::test::csf::JumpCollector::Jump::when
SimTime when
Definition: collectors.h:721
ripple::test::csf::TxCollector::Tracker::Tracker
Tracker(Tx tx_, SimTime submitted_)
Definition: collectors.h:187
ripple::test::csf::Ledger::id
ID id() const
Definition: ledgers.h:167
std::vector::emplace_back
T emplace_back(T... args)
ripple::test::csf::LedgerCollector::on
void on(PeerID, SimTime, E const &e)
Definition: collectors.h:474
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::test::csf::LedgerCollector::fullyValidToFullyValid
Hist fullyValidToFullyValid
Definition: collectors.h:469
std::endl
T endl(T... args)
ripple::test::csf::LedgerCollector::Tracker::accepted
SimTime accepted
Definition: collectors.h:456
std::left
T left(T... args)
ripple::test::csf::TxCollector::submitted
std::size_t submitted
Definition: collectors.h:176
ripple::test::csf::Collectors
Group of collectors.
Definition: collectors.h:53
std::unordered_map::begin
T begin(T... args)
ripple::test::csf::LedgerCollector::Tracker::fullyValidated
std::optional< SimTime > fullyValidated
Definition: collectors.h:457
std
STL namespace.
ripple::test::csf::LedgerCollector::Tracker
Definition: collectors.h:454
ripple::test::csf::TxCollector::validated
std::size_t validated
Definition: collectors.h:178
ripple::test::csf::TxCollector::Tracker::validated
std::optional< SimTime > validated
Definition: collectors.h:185
ripple::test::csf::Collectors::on
void on(PeerID who, SimTime when, E e)
Definition: collectors.h:87
std::count_if
T count_if(T... args)
ripple::test::csf::LedgerCollector::Tracker::Tracker
Tracker(SimTime accepted_)
Definition: collectors.h:459
ripple::test::csf::TxCollector::report
void report(SimDuration simDuration, T &log, bool printBreakline=false)
Definition: collectors.h:271
optional
std::size_t
std::unordered_map::end
T end(T... args)
ripple::test::csf::JumpCollector::Jump
Definition: collectors.h:718
ripple::tagged_integer< std::uint32_t, PeerIDTag >
std::setw
T setw(T... args)
ripple::test::csf::SimDuration
typename SimClock::duration SimDuration
Definition: SimTime.h:35
ripple::test::csf::CollectByNode
Maintain an instance of a Collector per peer.
Definition: collectors.h:110
ostream
ripple::test::csf::Collectors::Collectors
Collectors(Cs &... cs_)
Constructor.
Definition: collectors.h:81
ripple::test::csf::JumpCollector::on
void on(PeerID who, SimTime when, FullyValidateLedger const &e)
Definition: collectors.h:745
ripple::test::csf::SubmitTx
A transaction submitted to a peer.
Definition: events.h:89
std::unordered_map
STL class.
ripple::test::csf::StreamCollector
Write out stream of ledger activity.
Definition: collectors.h:683
ripple::test::csf::TxCollector::Tracker::submitted
SimTime submitted
Definition: collectors.h:183
ripple::test::csf::AcceptLedger::prior
Ledger prior
Definition: events.h:124
std::chrono