1#ifndef XRPL_OVERLAY_TRAFFIC_H_INCLUDED
2#define XRPL_OVERLAY_TRAFFIC_H_INCLUDED
4#include <xrpl/beast/utility/instrumentation.h>
5#include <xrpl/protocol/messages.h>
189 ::google::protobuf::Message
const& message,
190 protocol::MessageType type,
199 "ripple::TrafficCount::addCount : valid category input");
209 it->second.bytesIn += bytes;
210 ++it->second.messagesIn;
214 it->second.bytesOut += bytes;
215 ++it->second.messagesOut;
251 {
ld_tsc_get,
"ledger_data_Transaction_Set_candidate_get"},
252 {
ld_tsc_share,
"ledger_data_Transaction_Set_candidate_share"},
253 {
ld_txn_get,
"ledger_data_Transaction_Node_get"},
255 {
ld_asn_get,
"ledger_data_Account_State_Node_get"},
257 {
ld_get,
"ledger_data_get"},
259 {
gl_tsc_share,
"ledger_Transaction_Set_candidate_share"},
260 {
gl_tsc_get,
"ledger_Transaction_Set_candidate_get"},
264 {
gl_asn_get,
"ledger_Account_State_node_get"},
290 if (
auto it = category_map.
find(cat); it != category_map.
end())
TrafficStats(TrafficStats const &ts)
std::atomic< std::uint64_t > bytesOut
TrafficStats(TrafficCount::category cat)
std::atomic< std::uint64_t > messagesOut
std::atomic< std::uint64_t > messagesIn
std::atomic< std::uint64_t > bytesIn
TrafficCount is used to count ingress and egress wire bytes and number of messages.
auto const & getCounts() const
An up-to-date copy of all the counters.
std::unordered_map< category, TrafficStats > counts_
static category categorize(::google::protobuf::Message const &message, protocol::MessageType type, bool inbound)
Given a protocol message, determine which traffic category it belongs to.
static std::string to_string(category cat)
void addCount(category cat, bool inbound, int bytes)
Account for traffic associated with the given category.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.