3#include <xrpl/beast/utility/instrumentation.h>
4#include <xrpl/protocol/messages.h>
187 ::google::protobuf::Message
const& message,
188 protocol::MessageType type,
196 cat <=
Category::Unknown,
"xrpl::TrafficCount::addCount : valid category input");
206 it->second.bytesIn += bytes;
207 ++it->second.messagesIn;
211 it->second.bytesOut += bytes;
212 ++it->second.messagesOut;
220 [[nodiscard]]
auto const&
287 if (
auto it = kCategoryMap.
find(cat); it != kCategoryMap.
end())
Manages the set of connected peers.
std::atomic< std::uint64_t > bytesIn
TrafficStats(TrafficStats const &ts)
std::atomic< std::uint64_t > messagesIn
std::atomic< std::uint64_t > messagesOut
std::atomic< std::uint64_t > bytesOut
TrafficStats(TrafficCount::Category cat)
static Category categorize(::google::protobuf::Message const &message, protocol::MessageType type, bool inbound)
Given a protocol message, determine which traffic category it belongs to.
auto const & getCounts() const
An up-to-date copy of all the counters.
std::unordered_map< Category, TrafficStats > counts_
void addCount(Category cat, bool inbound, int bytes)
Account for traffic associated with the given category.
static std::string toString(Category cat)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.