3#include <xrpl/beast/utility/instrumentation.h>
5#include <google/protobuf/message.h>
194 ::google::protobuf::Message
const& message,
195 protocol::MessageType type,
205 cat <=
Category::Unknown,
"xrpl::TrafficCount::addCount : valid category input");
215 it->second.bytesIn += bytes;
216 ++it->second.messagesIn;
220 it->second.bytesOut += bytes;
221 ++it->second.messagesOut;
230 [[nodiscard]]
auto const&
297 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.