CatapultServer  v0.5.0.1 (Elephant)
RollbackStats.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "catapult/types.h"
23 #include <list>
24 
25 namespace catapult { namespace sync {
26 
28  enum class RollbackCounterType {
30  All,
31 
33  Recent,
34 
36  Longest
37  };
38 
40  class RollbackStats {
41  public:
43  RollbackStats();
44 
45  public:
47  uint64_t total(RollbackCounterType rollbackCounterType) const;
48 
50  void add(Timestamp timestamp, size_t rollbackSize);
51 
53  void prune(Timestamp threshold);
54 
55  private:
58  size_t RollbackSize;
59  };
60 
61  private:
62  uint64_t m_totalRollbacks;
63  std::list<RollbackStatsEntry> m_rollbackSizes;
65  };
66 }}
catapult::sync::RollbackStats::RollbackStatsEntry::Timestamp
catapult::Timestamp Timestamp
Definition: RollbackStats.h:57
catapult::sync::RollbackCounterType
RollbackCounterType
Rollback counter types.
Definition: RollbackStats.h:28
catapult::sync::RollbackStats::prune
void prune(Timestamp threshold)
Prunes statistics below time threshold.
Definition: RollbackStats.cpp:54
RollbackStats.h
catapult::sync::RollbackCounterType::Longest
Longest rollback.
catapult::utils::BaseValue< uint64_t, Timestamp_tag >
catapult::sync::RollbackStats::RollbackStats
RollbackStats()
Creates rollback statistics container.
Definition: RollbackStats.cpp:25
catapult::sync::RollbackStats::RollbackStatsEntry::RollbackSize
size_t RollbackSize
Definition: RollbackStats.h:58
catapult::sync::RollbackStats::m_rollbackSizes
std::list< RollbackStatsEntry > m_rollbackSizes
Definition: RollbackStats.h:63
catapult::sync::RollbackStats::total
uint64_t total(RollbackCounterType rollbackCounterType) const
Returns statistics for a type (rollbackCounterType).
Definition: RollbackStats.cpp:30
catapult::sync::RollbackStats::RollbackStatsEntry
Definition: RollbackStats.h:56
types.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::sync::RollbackCounterType::All
Number of rollbacks since start of the server.
catapult::sync::RollbackCounterType::Recent
Number of rollbacks within a time frame (configuration dependent).
catapult::sync::RollbackStats::m_longestRollback
uint64_t m_longestRollback
Definition: RollbackStats.h:64
catapult::sync::RollbackStats
Container for rollback statistics.
Definition: RollbackStats.h:40
catapult::sync::RollbackStats::add
void add(Timestamp timestamp, size_t rollbackSize)
Adds info about rollbackSize at timestamp to current statistics.
Definition: RollbackStats.cpp:45
catapult::sync::RollbackStats::m_totalRollbacks
uint64_t m_totalRollbacks
Definition: RollbackStats.h:62