Stats for all received and sent packets of all types.
More...
#include <time_period_packets_stats.hpp>
|
std::pair< bool, std::chrono::milliseconds > | validMaxStatsTimePeriod (const std::chrono::system_clock::time_point &start_time) const |
| Checks if now() - start_time is approximately equal to kResetTimePeriod. Stats are reset in regular interval, but it might be postponed due to lack o resources, in which case we dont want to count such stats when processing max stats. More...
|
|
Stats for all received and sent packets of all types.
◆ TimePeriodPacketsStats()
taraxa::network::tarcap::TimePeriodPacketsStats::TimePeriodPacketsStats |
( |
std::chrono::milliseconds |
reset_time_period, |
|
|
const addr_t & |
node_addr = {} |
|
) |
| |
◆ addReceivedPacket()
void taraxa::network::tarcap::TimePeriodPacketsStats::addReceivedPacket |
( |
const std::string & |
packet_type, |
|
|
const dev::p2p::NodeID & |
node, |
|
|
const PacketStats & |
packet |
|
) |
| |
◆ addSentPacket()
void taraxa::network::tarcap::TimePeriodPacketsStats::addSentPacket |
( |
const std::string & |
packet_type, |
|
|
const dev::p2p::NodeID & |
node, |
|
|
const PacketStats & |
packet |
|
) |
| |
◆ processStats()
void taraxa::network::tarcap::TimePeriodPacketsStats::processStats |
( |
const std::vector< std::shared_ptr< TaraxaPeer >> & |
all_peers | ) |
|
Logs both received as well as sent packets stats + updates max count/size and reset stats.
◆ validMaxStatsTimePeriod()
std::pair< bool, std::chrono::milliseconds > taraxa::network::tarcap::TimePeriodPacketsStats::validMaxStatsTimePeriod |
( |
const std::chrono::system_clock::time_point & |
start_time | ) |
const |
|
private |
Checks if now() - start_time is approximately equal to kResetTimePeriod. Stats are reset in regular interval, but it might be postponed due to lack o resources, in which case we dont want to count such stats when processing max stats.
- Returns
- <true, interval_ms> in case current time is valid time point for max stats -> now() - start_time == *kResetTimePeriod, otherwise <false, interval_ms>
◆ kResetTimePeriod
const std::chrono::milliseconds taraxa::network::tarcap::TimePeriodPacketsStats::kResetTimePeriod |
|
private |
◆ peer_max_stats_
MaxStats taraxa::network::tarcap::TimePeriodPacketsStats::peer_max_stats_ |
|
private |
◆ received_packets_stats_
PacketsStats taraxa::network::tarcap::TimePeriodPacketsStats::received_packets_stats_ |
|
private |
◆ sent_packets_stats_
PacketsStats taraxa::network::tarcap::TimePeriodPacketsStats::sent_packets_stats_ |
|
private |
The documentation for this class was generated from the following files: