3#include <xrpl/beast/utility/instrumentation.h>
4#include <xrpl/protocol/messages.h>
186 categorize(::google::protobuf::Message
const& message, protocol::MessageType type,
bool inbound);
192 XRPL_ASSERT(cat <=
category::unknown,
"xrpl::TrafficCount::addCount : valid category input");
202 it->second.bytesIn += bytes;
203 ++it->second.messagesIn;
207 it->second.bytesOut += bytes;
208 ++it->second.messagesOut;
244 {
ld_tsc_get,
"ledger_data_Transaction_Set_candidate_get"},
245 {
ld_tsc_share,
"ledger_data_Transaction_Set_candidate_share"},
246 {
ld_txn_get,
"ledger_data_Transaction_Node_get"},
248 {
ld_asn_get,
"ledger_data_Account_State_Node_get"},
250 {
ld_get,
"ledger_data_get"},
252 {
gl_tsc_share,
"ledger_Transaction_Set_candidate_share"},
253 {
gl_tsc_get,
"ledger_Transaction_Set_candidate_get"},
257 {
gl_asn_get,
"ledger_Account_State_node_get"},
283 if (
auto it = category_map.
find(cat); it != category_map.
end())
TrafficStats(TrafficCount::category cat)
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
TrafficCount is used to count ingress and egress wire bytes and number of messages.
std::unordered_map< category, TrafficStats > counts_
static std::string to_string(category cat)
void addCount(category cat, bool inbound, int bytes)
Account for traffic associated with the given category.
auto const & getCounts() const
An up-to-date copy of all the counters.
static category categorize(::google::protobuf::Message const &message, protocol::MessageType type, bool inbound)
Given a protocol message, determine which traffic category it belongs to.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.